Skip to main content

Express

Express.js

Pronunciation
ik-SPRESS
Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/express

In short

Express is the most widely used Node.js web framework: a minimal layer that handles routing, requests and responses through a chain of middleware functions.

What is Express?

Express was first released in 2010, soon after Node.js itself, and became the default way to write a Node server. It adds little on top of Node's built-in HTTP module: a router that maps methods and paths such as GET /users/:id to handler functions, helpers for reading the request and sending JSON or files, and a simple way to plug in middleware.

Middleware is the heart of Express. Each request passes through a list of functions in order; each one can read or change the request, send a response, or call next() to hand it on. Logging, parsing JSON bodies, checking authentication, handling CORS and serving static files are all middleware, and thousands of ready-made packages exist for them.

Because it is so small, Express leaves structure to you: how to organize folders, validate input, talk to the database or handle errors. That flexibility made it popular, and it is also why larger teams often adopt opinionated frameworks built around similar ideas, such as NestJS, or newer, faster ones such as Fastify and Hono. Express 5, released in 2024, finally added native support for async error handling.

A common misconception is that Express is a full-stack framework like Django or Rails. It has no ORM, no templates by default, no admin panel and no built-in project layout; it is a thin routing and middleware layer, which is exactly what many APIs need.

Key takeaways

  • Express is a minimal web framework for Node.js, first released in 2010.
  • Routes map HTTP methods and paths to handler functions.
  • Middleware functions process each request in order and call next().
  • It leaves project structure, validation and database access to you.
  • NestJS, Fastify and Hono are popular alternatives built on similar ideas.

Example

A small JSON API with middlewarejavascript
import express from "express";

const app = express();
app.use(express.json());                       // middleware: parse JSON bodies

app.use((req, res, next) => {                  // middleware: log every request
  console.log(req.method, req.path);
  next();
});

const books = [{ id: 1, title: "Dune" }];

app.get("/books/:id", (req, res) => {
  const book = books.find((b) => b.id === Number(req.params.id));
  if (!book) return res.status(404).json({ error: "Not found" });
  res.json(book);
});

app.post("/books", (req, res) => {
  const book = { id: books.length + 1, title: req.body.title };
  books.push(book);
  res.status(201).json(book);
});

app.listen(3000);

Readers ask

Is Express a backend framework?

Yes. Express runs on the server with Node.js and is used to build APIs and web servers. It is minimal, so it is often called a micro-framework.

What is middleware in Express?

A function that receives the request, the response and a next function. It can modify them, end the request with a response, or pass control to the next middleware or route.

Express or NestJS?

Express is lightweight and flexible, good for small services and quick APIs. NestJS adds a strict structure with modules, dependency injection and decorators, which helps large teams keep big codebases consistent. NestJS can even run on top of Express.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings