API Reference

Express

Fast, unopinionated, minimalist web framework for Node.js with robust routing and middleware ecosystem.

Official Documentation ↗
CompatibilityThis documentation covers version v5.3.0. Check the official docs for the latest API surface.

Installation

npmnpm install express
pnpmpnpm add express
yarnyarn add express

Methods

Express is the most popular Node.js web framework, providing a minimal and flexible API for building web applications and APIs. It features a robust routing system, middleware pipeline, and the largest ecosystem of third-party packages.

Key Features

  • Minimal core: Only routing and middleware, everything else is pluggable
  • Middleware pipeline: Sequential request processing with next() chain
  • Routing: Pattern matching, parameters, wildcards, and route grouping
  • Template engines: Support for Pug, EJS, Handlebars, and custom engines
  • Large ecosystem: 10,000+ npm packages with Express middleware
  • HTTP utilities: Built-in JSON parsing, static files, cookie parsing

Security notes

Quoted from the official documentation (https://expressjs.com/); this is not a complete threat model.

  • The OpenJS Foundation AI Coding Assistants Policy Bylaws Code of Conduct Cookie Policy Privacy Policy Security Policy Terms of Use Trademark List Trademark Policy Kawaii? (https://expressjs.com/)

FAQ

Should I use Express or Fastify for new projects?
Express has the largest ecosystem and middleware library. Fastify offers better performance (2-3x faster), built-in schema validation, and async support. Choose Express for ecosystem compatibility, Fastify for performance.
How do I handle async errors in Express?
Express 4 does not catch async errors automatically. Wrap handlers in try/catch and call next(err), or use express-async-errors package. Express 5 (beta) catches async errors natively.
What is Express 5 status?
Express 5 is in beta with breaking changes: async error support, path matching changes, and removed deprecated APIs. It is not recommended for production yet. Use Express 4.19+ for stable releases.