Node.js needs a framework
Node.js (Ryan Dahl, 2009) offers a server-side JavaScript runtime with event loop and non-blocking I/O, but the HTTP API is low-level. Writing REST APIs requires handling routing, body parsing, cookies, middleware. A minimal framework encapsulating common patterns is needed.
The release
Express.js is released from 16 November 2010 by TJ Holowaychuk (prolific author of JavaScript tools, also Mocha, Koa, Stylus). Inspired by Ruby’s Sinatra, it is a minimal framework for Node. MIT licence.
const express = require('express');
const app = express();
app.get('/users/:id', (req, res) => {
res.json({ id: req.params.id, name: 'Ada' });
});
app.listen(3000);
Features
- Routing —
app.get(),app.post(), routes with parameters and regex - Middleware —
app.use()composable pipeline for cross-cutting concerns - Request/Response helpers —
res.json(),res.send(),req.params,req.query,req.body - Template engines — Pug (formerly Jade), EJS, Handlebars supported
- Static files —
express.static()for assets - Error handling — 4-argument middleware
Middleware ecosystem
The Express ecosystem is huge:
- body-parser — parse JSON/URL-encoded bodies (integrated in Express 4.16+)
- cors — Cross-Origin Resource Sharing
- helmet — security headers
- morgan — HTTP request logger
- multer — multipart/form-data upload
- express-session — session management
- passport — authentication, 500+ strategies (OAuth, JWT, local)
- express-rate-limit — rate limiting
Main versions
- 1.0 (2010) — first release
- 2.x (2011) — restructuring
- 3.x (2012) —
res.redirect(), routes array - 4.0 (April 2014) — middleware now fully modular, removal of Connect dependency
- 5.0 (beta for many years, GA October 2024) — Node.js 18+, native async/await, minor breaking changes
TypeScript and successors
Express is pure JavaScript. For TypeScript-first the following have established themselves:
- NestJS (2017) — opinionated TS framework on Express/Fastify, DI, decorators
- Fastify (2016) — JSON Schema validation, faster than Express
- Koa (2013, same TJ) — async/await-based middleware
Express, however, remains the de facto standard for the majority of Node codebases.
Impact
Express defined the middleware pipeline pattern that influenced every subsequent framework (Koa, Fastify, NestJS, Go’s Gin, Chi, even Express.py). The bootcamp community and “MEAN/MERN stack” (MongoDB + Express + Angular/React + Node) tutorials made it ubiquitous.
In the Italian context
Express has been the de facto standard for Node.js APIs in Italy from 2012 onward. Every JS/TS development team in Italian agencies, startups, public bodies has used it. Many Italian fintech, e-commerce, digital PA applications have Node+Express backends.
References: Express.js (16 November 2010). TJ Holowaychuk. MIT licence. Inspired by Sinatra (Ruby). Middleware ecosystem (body-parser, cors, helmet, passport). Express 4 (April 2014), 5 (October 2024).
