Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2k
docs(express.json): clarify usage and add route-specific limit example#2037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:gh-pages
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
netlifybot commentedAug 11, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview forexpressjscom-preview ready!
To edit notification comments on pull requests, go to yourNetlify project configuration. |
github-actionsbot commentedAug 11, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
🚦 Lighthouse Results (Mobile & Desktop)
|
ShubhamOulkar left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think changes are required. Property table explainedlimit option very well and clear. See ouruse middleware page since this example explains how to useexpress.json() middleware.
kushal4345 commentedAug 16, 2025
Thanks for the review! I understand that the property table explains the In my experience, beginners often struggle to connect configuration options to real-world route usage, so I felt this would make the docs more practical and beginner-friendly. Of course, I’m happy to adjust the wording or placement if you think a shorter version would fit better. Please let me know your thoughts! |
ShubhamOulkar commentedAug 18, 2025
@kushal4345, I think updating |
kushal4345 commentedAug 18, 2025
Thanks for the suggestion i have Added a new section titled “Different Limits for Specific Routes” to the middleware page. |
kushal4345 commentedAug 21, 2025
Hi@ShubhamOulkar, I saw you requested changes, but I couldn’t find specific comments in the Files changed tab. Could you clarify what needs to be updated? I’ll make the adjustments accordingly. |
bjohansebas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for your contribution. I agree with@ShubhamOulkar; it makes more sense for this to be under theuse middleware page, not to add it in the API files, because each API describes its functionality and shouldn’t explain how to use it under different forms of middleware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
From what I can see, you made the change in the wrong file, judging by the commit message.
kushal4345 commentedAug 21, 2025
Hi I’ve updated the using-middleware.md guide to include an example of applying different JSON body size limits for specific routes. Added a code snippet showing how to set a custom limit (5mb) for /upload. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In this file neither, it’s in this one.
https://github.com/expressjs/expressjs.com/blob/gh-pages/en/guide/using-middleware.md
kushal4345 commentedAug 22, 2025
Thanks for the clarification I’ve added the new example for different limits inside en/guide/using-middleware.md under the Built-in middleware section as suggested. Please let me know if you’d like me to adjust the placement further. |
ShubhamOulkar left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please remove unnecessary changes
Uh oh!
There was an error while loading.Please reload this page.
| Bind application-level middleware to an instance of the[app object](/{{ page.lang }}/5x/api.html#app) by using the`app.use()` and`app.METHOD()` functions, where`METHOD` is the HTTP method of the request that the middleware function handles (such as GET, PUT, or POST) in lowercase. | ||
| This example shows a middleware function with no mount path. The function is executed every time the app receives a request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
These changes are not required. Please undo it.
| -[express.urlencoded](/en/5x/api.html#express.urlencoded) parses incoming requests with URL-encoded payloads.**NOTE: Available with Express 4.16.0+** | ||
| gh-pages | ||
| Here is an example of using the`express.json` middleware with a custom limit: |
ShubhamOulkarSep 7, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
🤔 Should we need separate pages for explaining how to use built in middleware options?
It feels off-topic on the page
Co-authored-by: shubham oulkar <91728992+ShubhamOulkar@users.noreply.github.com>
jonchurch commentedSep 22, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The root issueexpressjs/express#3932 that inspired the linked issue is really about understanding middleware ordering and targeting specific routes with specific middleware, not about I don't think the proposed change focused on |
karlhorky commentedSep 23, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@jonchurch hmm not sure what you mean. I understoodexpressjs/express#3932 to be about "how can I configure the I think my issue#1421 doesn't subvert that original wish, and that the changes in this PR are helpful for understanding how to achieve this common use case. Do you disagree with either of those things? |
Uh oh!
There was an error while loading.Please reload this page.
Summary
This PR updates the
express.json()documentation to:limitvalues for specific routes (e.g.,/upload).Changes
Reason
Closes#1421 requests additional clarity on using
express.json()with different route limits.This helps developers quickly understand how to override defaults for specific endpoints without affecting others.
Notes