Express basics · mid
What changed in Express 5
Express 5 (first released in late 2024; 5.3.0 is the npm 'latest' in November 2026) needs Node 18+, forwards async errors to error middleware, uses a stricter route path syntax and removes old APIs, so upgrading is mostly mechanical with the official codemods.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Requires Node 18 or newer. Rejected promises from handlers go to error middleware.
- Path syntax: named wildcards ('/*splat'), optional parts in braces ('/:file{.:ext}'), no regex in path strings (use an array of paths), reserved characters must be escaped.
- req.body is undefined (not {}) when no body parser ran; req.query is a read-only getter with the 'simple' parser; express.urlencoded has extended: false by default.
- Removed: app.del (use app.delete), req.param(name), res.sendfile (res.sendFile), res.json(obj, status) (use res.status(s).json(obj)), res.send(status) (use res.sendStatus), res.redirect('back') (use req.get('Referrer') || '/'); res.redirect(url, status) became res.redirect(status, url).
- Behaviour: res.status() only accepts integers 100-999; express.static ignores dotfiles by default (opt in for /.well-known); app.listen passes errors such as EADDRINUSE to its callback; req.host keeps the port; Brotli request bodies are decompressed.
- Upgrade: npx codemod@latest @expressjs/v5-migration-recipe, then run the tests. Express 4 still gets releases (4.22.x on the 'latest-4' tag), but new code should start on 5.
The red pen
Common traps: mistake → fix
Mistake: Express is unmaintained
Fix: Express 5 ships regular releases (5.3.0 in 2026) and both 4.x and 5.x are listed as supported.
Mistake: Upgrading to 5 does not touch my routes
Fix: wildcard, optional-parameter and regex routes must be rewritten.
Mistake: req.body is always an object
Fix: in Express 5 it is undefined without a parser; guard before destructuring.
Easy to hard
Questions interviewers ask, easy to hard
- Which Express version do you use? What changed in Express 5?
- What breaks when upgrading a large Express 4 app?
- How would you plan and verify the upgrade?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.