DocsCore toolchain

Runtime and HTTP

Run TypeScript, use Web APIs, serve HTTP, and manage process lifecycle

Run files and tasks

deno run main.ts
deno run --watch --allow-net main.ts
deno task dev

Use deno run for a direct entry point and deno task to standardize flags and permissions in deno.json. Team READMEs and CI should invoke tasks instead of duplicating argument sets.

Use web-standard APIs

const controller = new AbortController();

Deno.serve({ port: 8000, signal: controller.signal }, (request) => {
  const url = new URL(request.url);
  if (url.pathname === "/health") return Response.json({ ok: true });
  return new Response("Not found", { status: 404 });
});

Deno.addSignalListener("SIGTERM", () => controller.abort());
deno run --allow-net main.ts

Requests use standard Request, Response, URL, streams, and fetch. Deno.serve owns the listener; it does not replace authentication, rate limiting, or an operations platform.

Environment and exit behavior

const port = Number(Deno.env.get("PORT") ?? "8000");
if (!Number.isInteger(port)) throw new Error("PORT must be an integer");

Grant only the required name with --allow-env=PORT. Verify exit codes, uncaught exceptions, and signal behavior in the actual deployment environment.

Official references: Run code and HTTP server.

Type to search all documentation.