What is Express
A minimal, unopinionated web framework for Node.js - what Express adds on top of the raw http module, and why almost every Node.js backend starts here.
What it is, in plain English: Express is a web application framework for Node.js. It sits on top of Node's built-in http module and adds the things every server needs but http alone doesn't provide easily: clean routing (matching URLs and HTTP methods to handler functions), middleware (a pipeline for processing requests), and convenient request/response helpers. Express is deliberately minimal -- it doesn't force a project structure or include a database layer, which is why it has remained the most widely used Node.js framework for over a decade.
The framework almost every Node.js backend starts with
Node.js gives you the http module to build servers, but using it directly
means manually parsing URLs, checking HTTP methods with if/else chains, and writing headers
by hand for every response. Express wraps all of that in a clean, declarative API.
Installing and the simplest server
# npm init -y
# npm install expressimport express from "express";
const app = express();
app.get("/", (req, res) => {
res.send("Hello, World!");
});
app.listen(3000, () => {
console.log("Server running on http://localhost:3000");
});Compare this to raw Node.js http
// Raw http module -- you handle EVERYTHING manually:
import { createServer } from "http";
createServer((req, res) => {
if (req.method === "GET" && req.url === "/") {
res.writeHead(200, { "Content-Type": "text/plain" });
res.end("Hello, World!");
}
// ...and an if/else branch for every single route
}).listen(3000);
// Express -- the SAME thing, but declarative and readable:
app.get("/", (req, res) => res.send("Hello, World!"));
// Express handles: parsing the URL, matching the method, setting
// Content-Type automatically based on what you send, and 404 for
// anything that doesn't match any route.What Express gives you out of the box
// 1. Clean routing -- app.get, app.post, app.put, app.delete:
app.get("/users", handler);
app.post("/users", handler);
// 2. Route parameters -- no manual URL parsing:
app.get("/users/:id", (req, res) => {
res.send(`User ID: ${req.params.id}`);
});
// 3. Easy response helpers:
res.send("text or html");
res.json({ key: "value" });
res.status(404).send("Not found");
res.redirect("/login");
// 4. Middleware -- a pipeline for processing every request (covered next page)
app.use(express.json()); // parse JSON request bodies automaticallyWhat Express deliberately does NOT include
// Express is "unopinionated" -- it doesn't force a project structure
// or bundle a database, unlike fuller frameworks (Rails, Django, NestJS).
// You choose your own:
// - Database: PostgreSQL + Prisma, MongoDB + Mongoose, anything
// - Project structure: MVC, flat, feature-folders -- your choice
// - Validation: Zod, Joi, express-validator -- your choice
// - Authentication: Passport.js, custom JWT, anything
// This is WHY Express has remained dominant for over a decade --
// it's a thin, flexible layer, not a rigid framework you must conform to.
Try It Yourself (Node.js logic)
Official Sources
The Codex links only to official documentation. No third-party tutorials.