5-minute quickstart
Install Deno, run a least-privilege TypeScript HTTP service, and execute a test
1. Install and verify
macOS / Linux
curl -fsSL https://deno.land/install.sh | sh
deno --version
Windows
irm https://deno.land/install.ps1 | iex
deno --version
Docker
docker run --rm denoland/deno:latest deno --version
2. Initialize and run
deno init --serve hello-deno
cd hello-deno
deno task dev
deno init --serve creates deno.json, a server entry point, and tests. For a hand-written entry point, make the network permission explicit:
Deno.serve((_request) => Response.json({ ok: true }));
deno run --allow-net main.ts
curl http://localhost:8000
# {"ok":true}
3. Add a test
import { assertEquals } from "jsr:@std/assert";
Deno.test("adds two numbers", () => {
assertEquals(2 + 3, 5);
});
deno test
4. Pre-commit gate
deno fmt --check
deno lint
deno check **/*.ts
deno test
Official sources: Get started, Installation, and Testing.