-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Document customizing express.json()
size limit for specific routes
#1421
Comments
For future people here, I have a problem because I forgot my pre-fix API structure, all my endpoints start with for example import bodyParser from 'body-parser';
// others imports
// more code...
app.use('/api/posts',bodyParser.json({ limit: '50mb' }));
app.use(/^(?!\/api\/\/posts$)/, bodyParser.json()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the following issue, it is requested to customize the body size limit for
express.json()
dynamically based on the API route:express.json
limit option based on the route. express#3932There are some solutions provided in the thread, but maybe a simpler option would be this one inspired by this Stack Overflow answer:
This may be a nice example to document on the
express.json()
docs sectionThe text was updated successfully, but these errors were encountered: