Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Deno 5 min read How-to mediumAdept

Build a REST API with Express, TypeScript, and Deno

Deno runs Express with TypeScript without any TypeScript build configuration: Express is imported through an npm: specifier and its types are pulled in with a @deno-types comment. The walkthrough sets up a server that reads its port from the environment and starts it with explicit Deno permissions (--allow-read, --allow-net, --allow-env), which limits what third-party code can access. It also defines dev and start tasks in deno.jsonc, adds a request-logging middleware, and serves mock user data imported as JSON through /users and /users/:id routes, giving a REST API starting point in under 30 lines.

Assumes: Express basicsTypeScript basics

Related posts

  • Build a REST API with Express, TypeScript, and Deno, pt. 2

    Deno mediumAdept

    An Express REST API running on Deno gets integration tests via Deno.test using fetch against a configurable staging URL, and HTTP latency benchmarks via Deno.bench in a _bench file. The service is then containerized with a Dockerfile that runs deno cache and a deno.jsonc start task, launched with docker compose, and tested and benchmarked against the running container. Commenting out verbose request logging in middleware noticeably improves benchmark results, and deno bench --json can export results for automated tracking.

  • Build Apps in Deno with Frameworks such as React, Vue, Express, and more.

    Deno mediumAdept

    Deno 1.28's npm support lets you use npm-distributed frameworks like Express, React and Vue directly via `npm:` specifiers. You don't need package.json, node_modules or a separate install step, and Deno's built-in toolchain is available throughout. Step-by-step examples build a dinosaur API with Express. They then build the same dinosaur list/detail app in React (Vite scaffold via create-vite-extra, an Oak backend with CORS, react-router-dom) and in Vue (reactive store, Suspense, vue-router).

  • Build a dinosaur runner game with Deno, pt. 1

    Deno mediumAdept

    Part one of a series building a browser dinosaur runner game sets up a Deno project that serves static files and deploys it. It covers `deno init`, adding the Oak framework from JSR, defining `dev` and `start` tasks in deno.json with explicit `--allow-net`/`--allow-read`/`--env-file` permissions, and a minimal Oak server that serves `public/` via `context.send`. It also adds an `/api` router with a health check endpoint, then deploys with `deno deploy` using `src/main.ts` as the entry point.

  • Build a Typesafe API with tRPC and Deno

    Deno mediumAdept

    tRPC lets a Deno server and client share types through an exported router type, with no schema declarations or code generation. The tutorial installs tRPC v11 and Zod from npm, then builds a file-backed dinosaur API with query, mutation and async-iterable streaming procedures, served by tRPC's standalone HTTP adapter. The client uses splitLink with the batch-stream and subscription links and gets compile-time checking from the imported AppRouter type. Passing a number instead of a string shows Zod rejecting the input at runtime with an invalid_type error.

  • Deno 1.34: deno compile supports npm packages

    Deno mediumAdept

    Deno 1.34 lets `deno compile` bundle npm packages and their dependencies into a single self-contained executable. That makes tools like vite and eslint shippable as binaries with pinned dependencies, and they tend to start faster than running from a local cache. The release also adds cross-platform glob support in deno.json, deno task and CLI flags, and TLS certificates with IP addresses via rustls. Smaller changes include a top-level `exclude` and `nodeModulesDir` in config, configurable language-server limits, a `Deno.serve()` signature change that returns a `Deno.Server`, new `createHttpClient` pool options, more Node.js polyfills, and upgrades to V8 11.5 and TypeScript 5.0.4.

The quest for software engineering knowledge.

Look:
Layout: