Skip to content

HTTP & Networking

One of Node.js’s defining strengths is its first-class networking support baked directly into the runtime. Before frameworks like Express or Fastify existed, developers wrote HTTP servers using nothing but the built-in node:http module — and that module is still the engine under every framework today.

This module teaches you to work with HTTP at the level that matters: the request/response cycle, routing, headers, status codes, and outbound fetching. By the end you will understand what every framework does under the hood.

LessonTopic
HTTP Serverhttp.createServer, status codes, headers, res.end
RoutingManual routing on req.method and req.url
Outbound RequestsGlobal fetch, JSON, error handling
JSON APIParse body, route, respond with JSON

No npm install, no framework, no config files. This is a complete Node.js HTTP server:

Node.js

Needs the Node.js runtime — open in StackBlitz to run.

Three lines of logic — that is all it takes. The rest of this module unpacks each part.

Which module do you use to create an HTTP server in Node.js without any npm packages?
What does the `node:` prefix in `require("node:http")` indicate?
Which frameworks use `node:http` under the hood?