Skip to content
Back to skills

Express Knowledge Patch

ASecurity

Express

  • 25 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added September 5, 2026
developmentjavascriptjavanodeexpressdebuggingapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill express-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Express Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Express Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-express-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-express-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: express-knowledge-patch
description: Express
version: "5.2.x"
license: MIT
metadata:
  author: Nevaberry
---


# Express Compatibility Guidance

Load this skill when migrating Express applications or working with route
parameters, request parsing, responses, static files, views, or server startup.
Use the topic references for the detailed behavior and examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [Migration, routing, and errors](references/migration-routing-and-errors.md) | Codemods, parameter registration, route syntax, parameter objects, promises, error logging |
| [Requests and parsing](references/requests-and-parsing.md) | Separate body parsers, nesting depth, query parser rollbacks, query arrays, limit validation |
| [Responses, static files, and views](references/responses-static-and-views.md) | Removed file options, dotfiles, MIME types, redirects, headers, binary responses, links, rendering |
| [Server startup, debugging, and lifecycle](references/server-debug-and-lifecycle.md) | Listen errors, router logging, npm tags, proposed support policy, release history |

## Replace removed APIs and options

Express 5 removes the function-only `router.param(fn)` registration overload.
Register callbacks by name; use `app.param('id', onId)` for a route parameter
written as `:id`.

`router.param()` rejects arrays of names with
`TypeError: argument name must be a string`. Register names separately on a
router, or pass an array to `app.param()` for application-level registration.

```js
router.param('id', loadParam)
router.param('page', loadParam)
```

Express 5 removes the `hidden` and `from` options for `res.sendFile()` and
`express.static()`. Replace `hidden: true` with `dotfiles: 'allow'`. Supply
the directory through `res.sendFile()`'s `root` option or `express.static()`'s
first argument.

```js
app.get('/build', (req, res) => {
  res.sendFile('index.html', { root: '/srv/build', dotfiles: 'allow' })
})
app.use('/files', express.static('/srv/files', { dotfiles: 'allow' }))
```

Replace the removed `express.static.mime.lookup()` with
`require('mime-types').lookup()`. See the response reference for the changed
MIME mappings and the HTML static response charset.

The `body-parser` dependency removes the combined `bodyParser()` middleware.
Register both parsers separately if the application accepts both JSON and
URL-encoded bodies.

```js
app.use(express.json())
app.use(express.urlencoded({ extended: false }))
```

## Update deprecated handler and redirect usage

In Express 5.1.0, the router deprecates non-native promises returned by route
handlers and middleware. Use an `async` function or return a native `Promise`.

Express 5.2.0 emits deprecation warnings for `undefined` arguments to
`res.redirect()`. Provide a destination; use `res.redirect('/login')` when
you want the default status.

`res.location('back')` loses its special handling in Express 5. Preserve the
previous behavior with `res.location(req.get('Referrer') || '/')`.

## Check route syntax and parameter objects

Escape literal `()[]?+!` in string paths. Double-quote parameter names that
are outside JavaScript identifier syntax.

```js
app.get('/reports/summary\\(draft\\)', (req, res) => res.send('Draft'))
app.get('/reports/:"report-id"', (req, res) => res.send(req.params['report-id']))
```

String routes produce null-prototype `req.params` objects; RegExp routes
retain standard objects. Express 5 omits unmatched optional parameter keys,
including optional wildcards.

```js
app.get('/:file{.:ext}', (req, res) => {
  res.json({ hasExtension: Object.hasOwn(req.params, 'ext') })
  // GET /image returns {"hasExtension":false}
})
```

In Express 4.22.0, HTTP method calls that register routes throw if the path
is omitted. Pass the path as the first argument.

## Handle stricter calls and deferred callbacks

`res.vary()` throws if the field is omitted. Pass a header name, for example
`res.vary('Accept-Encoding')`.

Express 5 passes server startup errors such as `EADDRINUSE` to the supplied
`app.listen()` callback. Check the error before reporting that the server is
listening.

```js
app.listen(8080, (error) => {
  if (error) {
    console.error(error)
    process.exitCode = 1
    return
  }
  console.log('Listening on port 8080')
})
```

Express 5 defers rendering callbacks even when the view engine completes
synchronously. Code that needs the rendered output must wait for the callback.

## Configure request parsing

The URL-encoded body parser defaults to a maximum nesting depth of 32 in
Express 5.0.0. Express 4.20.0 changes its default from unlimited to 32.
Set `depth` to change the limit for nested forms parsed with `extended: true`.

```js
app.use(express.urlencoded({ extended: true, depth: 16 }))
```

Express 4.22.0's extended query parser change was fully reverted in 4.22.1.
Use 4.22.1 or later to retain the previous parser behavior when upgrading
within Express 4.x. The associated CVE-2024-51999 was rejected.

Express 5.2.0 introduced a breaking change for apps using
`app.set('query parser', 'extended')`. Upgrade to 5.2.1 to restore the prior
parsing behavior.

Express 4.22.2 restores arrays for more than 20 repeated query values for a
key. Indexed keys such as `a[0]` support up to 1000 array items, up from 20.

Express 5.3.0 upgrades to `qs` `^6.16.0`, which enforces `arrayLimit` on
comma-separated values when comma parsing is enabled.

## Check hidden paths against the file-serving root

The default `dotfiles: 'ignore'` also applies to files under dot-prefixed
directories. An absolute `res.sendFile()` path is checked in full when no
`root` is supplied. Both file-serving APIs check only the path below a
configured root.

```js
app.get('/build', (req, res) => {
  res.sendFile('index.html', { root: '/var/www/app/.cache' })
})
```

## Use response options

Express 5.1.0 supports sending a `Uint8Array` directly as binary bytes,
disabling ETags per file with `etag: false`, and passing an array of URLs for
one relation in `res.links()` to emit separate `Link` entries.

```js
res.send(new Uint8Array([0x01, 0x02, 0x03]))
```

```js
res.sendFile('report.pdf', { root: '/srv/reports', etag: false })
```

```js
res.links({ alternate: ['/feed.json', '/feed.xml'] })
```

In Express 5.3.0, `res.send()` can generate an `ETag` when
`Transfer-Encoding` is set and ETag generation is enabled.

## Run migration tools and enable router logs

Pass a transform name to `@expressjs/codemod` for a targeted migration.
The Codemod CLI can apply the Express 5 migration transforms together through
the registry recipe.

```sh
npx @expressjs/codemod v4-deprecated-signatures
```

```sh
npx codemod@latest @expressjs/v5-migration-recipe
```

Router logs leave `express:*` in Express 5. In 5.1 and later, enable `router`
for the base logger and `router:*` for layer and route loggers.

```sh
DEBUG=express:*,router,router:* node index.js
```

## Consult unreleased behavior by topic

The references label unreleased guidance for response headers, conditional
QUERY responses, redirect HTML, render options, default error logging,
download filename serialization, and body parser limit validation.

Files in this skill

  • SKILL.md7.2 KB
  • coverage.json645 B
  • references/migration-routing-and-errors.md2 KB
  • references/requests-and-parsing.md1.2 KB
  • references/responses-static-and-views.md2.4 KB
  • references/server-debug-and-lifecycle.md1.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.