Cette page est affichée en anglais. Une traduction française est en cours.
SkillsApr 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.

Prêt pour agents

Installation avec revue préalable

Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.

Needs Confirmation · 64/100Policy : confirmer
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
step-1.md
Commande avec revue préalable
npx -y tokrepo@latest install cc16528f-362e-11f1-9bc6-00163e2b0d79 --target codex

Dry-run d'abord, confirmez les écritures, puis lancez cette commande.

TL;DR
Express is the minimal, flexible Node.js web framework that inspired Koa, Hono, Fastify, and remains the go-to starting point for backends.
§01

What it is

Express is the original and most popular web framework for Node.js. It provides a minimal, unopinionated foundation for building web applications and APIs. Express handles routing, middleware composition, request/response processing, and template rendering.

Express inspired an entire generation of Node.js frameworks including Koa, Hono, Fastify, and NestJS. Despite newer alternatives, it remains the most widely used Node.js backend framework.

§02

How it saves time or tokens

Express reduces the boilerplate of raw Node.js HTTP servers to a few lines. Its middleware pattern lets you compose authentication, logging, CORS, body parsing, and error handling as reusable functions. The massive npm ecosystem means most common tasks have an Express middleware already built.

For AI code generation, Express is the most well-represented Node.js framework in training data. LLMs produce accurate Express code more reliably than for newer, less documented alternatives.

§03

How to use

  1. Initialize a project and install Express:
mkdir my-api && cd my-api
npm init -y
npm install express
  1. Create a basic server:
const express = require('express');
const app = express();

app.use(express.json());

app.get('/api/health', (req, res) => {
  res.json({ status: 'ok' });
});

app.post('/api/users', (req, res) => {
  const { name, email } = req.body;
  res.status(201).json({ id: 1, name, email });
});

app.listen(3000, () => console.log('Server running on port 3000'));
  1. Add middleware for authentication, logging, or validation as needed.
  1. Deploy with PM2, Docker, or any Node.js hosting platform.
§04

Example

// Express middleware pattern
const authMiddleware = (req, res, next) => {
  const token = req.headers.authorization;
  if (!token) return res.status(401).json({ error: 'Unauthorized' });
  req.userId = verifyToken(token);
  next();
};

app.get('/api/profile', authMiddleware, (req, res) => {
  res.json({ userId: req.userId });
});
§05

Related on TokRepo

§06

Common pitfalls

  • Not handling async errors. Express 4 does not catch promise rejections in route handlers. Either use express-async-errors or wrap handlers in try-catch. Express 5 fixes this.
  • Blocking the event loop with synchronous operations. Heavy computation in Express route handlers blocks all other requests. Use worker threads or offload to a queue.
  • Using Express for real-time features without WebSocket support. Express handles HTTP only. For WebSocket, add socket.io or ws on top.
  • Failing to review community discussions and changelogs before upgrading. Breaking changes in major versions can disrupt existing workflows. Pin versions in production and test upgrades in staging first.

Questions fréquentes

Is Express still relevant in 2026?+

Yes. Express remains the most downloaded Node.js framework on npm. While newer frameworks like Fastify and Hono offer better performance and TypeScript support, Express has the largest ecosystem, most tutorials, and broadest community. It is a safe choice for most projects.

How does Express compare to Fastify?+

Fastify is faster than Express in benchmarks due to its schema-based validation and optimized routing. Fastify also has better TypeScript support and built-in JSON schema validation. Express is simpler, has more middleware available, and is better supported by AI code generation tools.

Does Express support TypeScript?+

Express works with TypeScript via @types/express. However, its middleware typing is less ergonomic than purpose-built TypeScript frameworks like Hono or tRPC. For type-safe Express development, use the types package and define typed request/response interfaces.

What is the Express middleware pattern?+

Middleware functions in Express have access to the request, response, and next function. They can modify the request/response, end the cycle, or call next() to pass control to the next middleware. This composable pattern is Express's core architecture.

Should I use Express for new projects?+

For simple REST APIs and prototypes, Express is a solid choice due to its simplicity and ecosystem. For high-performance APIs, consider Fastify. For full-stack TypeScript apps, consider NestJS or Hono. Express is best when you want minimal opinions and maximum flexibility.

Sources citées (3)

Fil de discussion

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

Actifs similaires