Skip to content

Commit 7940a18

Browse files
committed
docs: include express.json example in using middleware page
1 parent 0e581e1 commit 7940a18

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

_includes/api/en/4x/express.json.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,3 @@ The following table describes the properties of the optional `options` object.
4040
| `verify` | This option, if supplied, is called as `verify(req, res, buf, encoding)`, where `buf` is a `Buffer` of the raw request body and `encoding` is the encoding of the request. The parsing can be aborted by throwing an error. | Function | `undefined` |
4141

4242
</div>
43-
44-
#### Example: Different limits for specific routes
45-
46-
```js
47-
// Limit 5MB for /upload
48-
app.use('/upload', express.json({ limit: '5mb' }))
49-
50-
// Default limit for other routes
51-
app.use(express.json())

_includes/api/en/4x/express.static.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,13 @@ var options = {
9393

9494
app.use(express.static('public', options))
9595
```
96+
<h4 id='example.of.express.json'>Example of express.json</h4>
97+
98+
Here is an example of using the `express.json` middleware function with a custom limit:
99+
100+
```js
101+
// Apply a 5MB limit for /upload requests
102+
app.use('/upload', express.json({ limit: '5mb' }))
103+
104+
// Use default limit for all other routes
105+
app.use(express.json())

0 commit comments

Comments
 (0)