npm / express
express
What changed in express 4 to 5, from its official release notes, upgrade guides and advisories. Also covers @types/express. Sources checked 2026-11-30.
37 breaking4 security1 deprecations1 new APIs and options12 behavior and defaults1 tooling6 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initexpress 560 changes
Breaking changes 36
Invalid limit values now throw during parser initialization instead of being ignored, preventing request body size enforcement from being silently disabled.
Valid HTTP-token file names are no longer quoted in the Content-Disposition header; applications asserting exact header bytes may need to update expectations.
Express 5 no longer supports app.del(); use app.delete() to register HTTP DELETE routes.
The app.param(fn) signature is no longer supported; it had been deprecated since v4.11.0.
Deprecated API method signatures from Express v3 and v4 have been removed.
The dotfiles option now defaults to ignore, so hidden files and directories are not served unless explicitly allowed.
The from option is no longer supported; use root instead.
The hidden option is no longer supported; use dotfiles instead.
mime is no longer exported on express.static; use the mime-types package to work with MIME type values.
The extended option now defaults to false; explicitly set it to true if the application relies on extended parsing.
Express 5 requires Node.js version 18 or higher.
Route wildcards must be named, optional segments use braces instead of ?, regexp characters are unsupported, reserved characters must be escaped, and parameter names can be valid JavaScript identifiers or quoted.
Routing uses path-to-regexp@8.x, which removes sub-expression regex patterns to mitigate ReDoS.
The singular method is no longer supported; use req.acceptsCharsets().
The singular method is no longer supported; use req.acceptsEncodings().
The singular method is no longer supported; use req.acceptsLanguages().
req.body is undefined when the request body has not been parsed; it previously returned an empty object.
req.param(name) has been removed; read submitted values from req.params, req.body, or req.query instead.
For string paths, req.params has a null prototype; wildcard captures are arrays and unmatched parameters are omitted. Regexp paths still produce a standard object.
req.query is now a getter rather than a writable property, and the default query parser changes from extended to simple.
res.clearCookie ignores user-provided maxAge and expires options.
The res.json(obj, status) signature is unsupported; set the status with res.status(status).json(obj).
The res.jsonp(obj, status) signature is unsupported; set the status with res.status(status).jsonp(obj).
The magic string back is no longer supported; use req.get('Referrer') || '/' to refer to the previous page.
The magic string back is no longer supported; use req.get('Referrer') || '/' to redirect to the previous page.
The status and URL arguments are now ordered as res.redirect(status, url).
res.render now enforces asynchronous behavior for all view engines, avoiding bugs from synchronous implementations that violate the recommended interface.
The res.send(obj, status) signature is unsupported; set the status with res.status(status).send(obj).
Passing a number as the sole argument is unsupported; use res.sendStatus(statusCode) to set the status and send its text.
The lowercase method has been replaced by res.sendFile().
The from option is no longer supported; use root instead.
The hidden option is no longer supported; use dotfiles instead.
res.status accepts only integer status codes from 100 to 999 and errors when the code is not an integer.
res.vary throws an error when the field argument is missing; it previously logged a warning.
The router.param(fn) signature is no longer supported; it had been deprecated since v4.11.0.
router.param(name, fn) no longer accepts an array of names; register each name with its own call.
Security 4
Upgraded to fix CVE-2026-90711.
Upgraded to fix arrayLimit bypasses in comma parsing and a denial of service via an attacker-controlled isBuffer.
body-parser was upgraded to 2.2.1 to address CVE-2025-13466.
A security fix addresses CVE-2024-51999.
Deprecations 1
Deprecation warnings are now emitted for redirect arguments that are undefined.
New APIs and options 1
The urlencoded body parser now allows its body depth to be customized.
Behavior and default changes 11
Now logs the full error object instead of only its stack trace, retaining nested details such as Error.cause and library-specific properties.
Freshness validation now includes QUERY requests, allowing matching conditional validators to produce 304 responses.
HTML-format redirect responses now include a doctype, title, and body for better browser compatibility.
When supplied, the callback is invoked on server error and receives the error as an argument instead of the error being thrown.
A leading colon in the name is silently ignored; the name is used without the colon prefix.
express.json(), express.urlencoded(), express.text(), and express.raw() now decompress incoming request bodies encoded with Brotli, in addition to gzip and deflate.
express.static() and res.sendFile() now serve .js files as text/javascript instead of application/javascript.
Rejected promises returned by middleware and handlers are forwarded as Errors to error-handling middleware, making async handlers usable without manually catching errors.
The port number is now preserved in req.host.
The dotfiles check also covers hidden directories in the evaluated path; hidden directories may require dotfiles: 'allow'.
Router debug logs use the router, router:layer, and router:route namespaces; include router namespaces in DEBUG settings to see them.
Tooling 1
A codemod recipe can automatically update an Express server to the latest version.
Fixes and other changes 6
Passing null as options now handles the locals object correctly and behaves like omitting options or passing an empty object.
Only adds Content-Length when Transfer-Encoding is absent, preventing conflicting response headers; ETag generation is unaffected by Transfer-Encoding.
When adding a charset, existing Content-Type parameters are preserved, and a Content-Type that fails to parse no longer throws.
Avoids duplicate Content-Type header processing when sending string responses without an explicit Content-Type header.
The breaking change to the extended query parser introduced in 5.2.0 was fully reverted.
The app.router object is available again as a reference to the base Express router.
express 42 changes
Breaking changes 1
Method functions called without a path now error.
Behavior and default changes 1
Repeated-key arrays can contain more than 20 items, and indexed notation now allows up to 1000 items, unifying array-cap behavior across notations.