Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 12, 2026·2 min de lecture

Express — Fast Unopinionated Minimalist Web Framework for Node.js

Express is the original, most popular web framework for Node.js. Minimal, flexible, and the foundation of countless APIs. The go-to starting point for Node.js backends that inspired Koa, Hono, Fastify, and many others.

Introduction

Express is the fast, unopinionated, minimalist web framework for Node.js. Created by TJ Holowaychuk in 2010, Express became the de facto standard for building web applications and APIs in Node.js. It provides a thin layer of fundamental web application features without obscuring Node.js features. Nearly every Node.js tutorial starts with Express.

What Express Does

  • Routing — path, method, regex matching
  • Middleware — composable request/response pipeline
  • Request/response — enhanced req/res objects
  • Error handling — centralized error middleware
  • Static filesexpress.static() built in
  • Template engines — Pug, EJS, Handlebars via app.engine()
  • JSON parsingexpress.json() middleware
  • Cookies/sessions — via cookie-parser and express-session
  • CORS — via cors middleware
  • Express 5 — native async error handling (upcoming)

Architecture

Middleware stack: each app.use() adds a function to the pipeline. Request enters, flows through middleware in order, and hits the matching route handler. Router is a mini-app with its own middleware and routes. Error middleware has 4 arguments (err, req, res, next).

Self-Hosting

# Production
NODE_ENV=production node server.js

# PM2
npm i -g pm2
pm2 start server.js -i max
pm2 startup && pm2 save

# Docker
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
CMD ["node", "server.js"]

Key Features

  • Minimal and unopinionated
  • Middleware-based architecture
  • Huge middleware ecosystem
  • Template engine support
  • Static file serving
  • HTTP utility methods
  • Easy to learn
  • Express Generator for scaffolding
  • Works with any Node.js version

Comparison

Framework Speed Opinionated TS
Express OK No via @types
Fastify Fast Slightly Yes
Hono Fast No Yes
Koa OK No via @types
NestJS OK (Express/Fastify) Yes Yes

FAQ

Q: Is Express outdated? A: No. Fastify and Hono perform better, but Express has the largest ecosystem, the most tutorials, and the richest middleware. Many production apps still use it and run stably. Express 5 is under development.

Q: TypeScript support? A: With @types/express you get full types. Many projects use ts-node or tsx during development.

Q: Error handling? A: Express 4 requires wrapping async handlers with try-catch or using express-async-errors. Express 5 natively catches async throws and forwards them to error middleware.

Sources

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires