Skip to content

Node.js HTTP and Express

Node.js can build servers directly with the built-in http module, but many teams use a framework such as Express to standardize routing, middleware, and request handling.

const http = require("http");
const server = http.createServer((req, res) => {
res.writeHead(200, { "Content-Type": "text/plain" });
res.end("Hello from Node.js");
});
server.listen(3000);
  • cleaner route definitions
  • middleware support
  • easier request and response handling
  • large ecosystem of backend patterns

Node.js itself is the runtime. Express is one common application framework built on top of it.