Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/content/api/4x/api/express/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ may not be a function and instead a string or other user-input.

</Alert>

<Alert type="info">

`express.json()` (and other body-parsing middleware) will attempt to parse a request body
regardless of the HTTP method — including `GET`, `HEAD`, and `DELETE` requests that
conventionally carry no body. When using body-parsing middleware globally with `app.use()`,
consider registering any rate-limiting or request-size-limiting middleware **before**
body-parsing middleware in the chain, and apply body-parsing only to routes that expect a
request body where possible.

</Alert>

```cjs title="index.cjs" ins={5}
var express = require('express');
var app = express();
Expand Down
11 changes: 11 additions & 0 deletions src/content/api/5x/api/express/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ may not be a function and instead a string or other user-input.

</Alert>

<Alert type="info">

`express.json()` (and other body-parsing middleware) will attempt to parse a request body
regardless of the HTTP method — including `GET`, `HEAD`, and `DELETE` requests that
conventionally carry no body. When using body-parsing middleware globally with `app.use()`,
consider registering any rate-limiting or request-size-limiting middleware **before**
body-parsing middleware in the chain, and apply body-parsing only to routes that expect a
request body where possible.

</Alert>

```cjs title="index.cjs" ins={5}
const express = require('express');
const app = express();
Expand Down
Loading