Skip to content
Back to skills

Express Knowledge Patch

ASecurity

Express

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

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-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-express-knowledge-patch-nevaberry-plugins)

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 Knowledge Patch

Load this skill when migrating Express applications or working with route
parameters, request parsing, responses, file serving, rendering, startup errors,
or release behavior. Guidance labeled unreleased retains that status.

## Reference index

| Reference | Topics |
| --- | --- |
| [Migration, routing, and handlers](references/migration-routing-and-handlers.md) | Codemods, route paths, parameter registration and objects, handler promises |
| [Operations and release behavior](references/operations-and-release-behavior.md) | npm tags, support phases, listen errors, debug namespaces, error logs, package history |
| [Requests, middleware, and rendering](references/requests-middleware-and-rendering.md) | Body parsers, nesting and size limits, query parser rollbacks and arrays, rendering |
| [Responses and files](references/responses-and-files.md) | Binary responses, links, validators, headers, redirects, file options, dotfiles, MIME types |

## Breaking changes and deprecations

### Route registration and parameter callbacks

Express 4.22.0 throws when an HTTP method call registers a route without a path.
Pass the path as the first argument.

Express 5 removes the function-only `router.param(fn)` registration overload.
Register callbacks by name; use `app.param('id', onId)` for a route parameter `:id`.
Passing an array of names to `router.param()` throws
`TypeError: argument name must be a string`. Register router names separately,
or use an array with `app.param()` for application-level registration.

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

### String path syntax and parameter objects

Escape literal `()[]?+!` in string paths. Double-quote parameter names 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']))
```

In Express 5, string routes produce a null-prototype `req.params` object;
RegExp routes retain a standard object. Keys for unmatched optional parameters,
including optional wildcards, are omitted.

### File-serving options and hidden directories

Express 5 removes `hidden` and `from` from `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' }))
```

The default `dotfiles: 'ignore'` also applies below dot-prefixed directories.
Without `root`, an absolute `res.sendFile()` path is checked in full.
With a configured root, both file-serving APIs check only the path below it.

### Redirects, Location, and Vary

- Express 5 removes special handling of `res.location('back')`. Preserve the
  previous behavior with `res.location(req.get('Referrer') || '/')`.
- Express 5.2.0 warns about `undefined` arguments to `res.redirect()`.
  Provide a destination; use `res.redirect('/login')` for the default status.
- `res.vary()` throws when the field is omitted. Pass a header name explicitly,
  for example `res.vary('Accept-Encoding')`.

### Separate body parsers

The `body-parser` dependency removes the combined `bodyParser()` middleware.
Register both parsers separately if the application accepts both formats.

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

### Handler promises and rendering callbacks

The router deprecates non-native promises returned by route handlers and
middleware. Use an `async` function or return a native `Promise`.
Express 5 defers rendering callbacks even when the view engine completes
synchronously. Code needing the rendered output must wait for the callback.

### Startup errors

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

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

## Migration commands

Pass a transform name to `@expressjs/codemod` for a targeted migration.
Available transforms include `v4-deprecated-signatures`, `pluralized-methods`,
`req-param`, and `magic-redirect`.

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

Run the registry recipe through the Codemod CLI to apply Express 5 transforms
together. Individual registry transforms include `@expressjs/sendfile-options`
and `@expressjs/static-dotfiles`.

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

## Request parsing quick reference

### Form nesting

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

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

### Query parser fixes and limits

- Express 4.22.1 fully reverted the extended query parser breaking change in
  4.22.0. Use 4.22.1 or later to retain the previous behavior within Express 4.x.
  The associated CVE-2024-51999 was rejected.
- For apps using `app.set('query parser', 'extended')`, upgrade from Express
  5.2.0 to 5.2.1 to restore the prior parsing behavior.
- Express 4.22.2 restores arrays in `req.query` for more than 20 repeated values
  of 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`, enforcing `arrayLimit` on
  comma-separated values when comma parsing is enabled.

## Responses and files quick reference

### Binary bodies, per-file ETags, and links

In Express 5.1.0, send `Uint8Array` bytes directly, disable ETag generation for
an individual file with `etag: false`, and pass an array of URLs for one link
relation to emit a separate `Link` header entry for each URL under that relation.

```js
res.send(new Uint8Array([0x01, 0x02, 0x03]))
res.sendFile('report.pdf', { root: '/srv/reports', etag: false })
res.links({ alternate: ['/feed.json', '/feed.xml'] })
```

### MIME lookup

Replace removed `express.static.mime.lookup()` with `require('mime-types').lookup()`.
New mappings include `text/javascript` for `.js`, `application/json` for `.json`,
`text/css` for `.css`, `application/xml` for `.xml`, `font/woff` for `.woff`,
and `image/svg+xml` for `.svg`. HTML static responses include `charset=utf-8`.

### Validators with Transfer-Encoding

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

### Unreleased response behavior

- `res.send()` generates `Content-Length` only when there is no `Transfer-Encoding`.
- `req.fresh` evaluates validators for HTTP `QUERY`; a matching validator can
  make `res.send()` return 304 for a conditional QUERY.
- With `content-type` 2.x, `res.send()` preserves existing Content-Type parameters
  when adding a charset. A parse failure during charset handling no longer throws.
- HTML negotiated by `res.redirect()` includes a doctype, title, and body tags.
  Update tests that match the generated HTML exactly.
- With `content-disposition` 2.x, valid HTTP-token filenames appear without
  quotes in Content-Disposition emitted by `res.download()`, `res.attachment()`,
  and `res.sendFile()`.

## Diagnostics quick reference

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
```

Unreleased: the default error handler logs the full error object, preserving
details such as `Error.cause` and custom error properties.

Files in this skill

  • SKILL.md7.4 KB
  • coverage.json644 B
  • references/migration-routing-and-handlers.md2.1 KB
  • references/operations-and-release-behavior.md1.7 KB
  • references/requests-middleware-and-rendering.md1.9 KB
  • references/responses-and-files.md2 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.