Build a Server With Only node:http
Build a real web server using nothing but Node's built-in http module: the server/request/response model, reading requests and writing JSON, routing by hand, middleware as plain functions, a full REST API with no framework, async and streams and structure, and exactly what Express adds on top. The foundation every Node framework is built on.
- The node:http Mental Model Node ships a complete HTTP server in node:http; createServer calls your one (req, res) listener for every request, and you write the routing and middleware yourself.
- Handling Requests & Responses Read method, URL, headers, and the body-stream off req; write a status, headers, and JSON to res. The manual request/response work that express.json() hides from you.
- Routing by Hand node:http has no router — you dispatch by inspecting req.method and the URL yourself, match path params with regex, and watch the if-ladder grow into the exact problem Express solves.
- Middleware Is Just a Function Middleware in node:http has no special machinery — it's a plain function you call before your handler to log, authenticate, or parse, and that can short-circuit by responding and returning.
- A JSON REST API With No Framework Assemble the request/response helpers, hand-rolled routing, and middleware into a full CRUD messages API — five operations, manual validation, correct status codes, standard library only.
- Async, Streams & Structure Real node:http servers are async, stream data instead of buffering it, shut down gracefully on SIGTERM, and split one growing file into modules. The production-shaped version of everything you've built.
- What Express Adds Map Express back onto the node:http you just built — routing, body parsing, middleware, response helpers, error handling — and decide honestly whether a tiny service even needs a framework.