-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 our terms of service and privacy 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?
Conversation
✅ Deploy Preview for expressjscom-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🚦 Lighthouse Results (Mobile & Desktop)
|
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 explained limit
option very well and clear. See our use middleware page
since this example explains how to use express.json()
middleware.
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! |
@kushal4345, I think updating |
97e21b2
to
7940a18
Compare
Thanks for the suggestion i have Added a new section titled “Different Limits for Specific Routes” to the middleware page. |
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. |
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 the use 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.
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
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. |
Summary
This PR updates the
express.json()
documentation to:limit
values for specific routes (e.g.,/upload
).Changes
Reason
Issue #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