Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Document customizingexpress.json() size limit for specific routes #1421

Open
Labels
4.xDocs for 4.x version5.xDocs for 5.x versiondocsIssues/pr concerning content
@karlhorky

Description

@karlhorky

In the following issue, it is requested to customize the body size limit forexpress.json() dynamically based on the API route:

@marbuser (Apr 11, 2019):
I've got some endpoints and 90% of them I want to have a limit of around '2MB'. However, there is 1 specific route, my upload route, where I want to have an upload limit of '10MB'.

There are some solutions provided in the thread, but maybe a simpler option would be this one inspired bythis Stack Overflow answer:

// Parse application/json// - limit on /upload: 5MB// - limit on other routes: default of 100KBapp.use('/upload',express.json({limit:'5mb'}));app.use(/^(?!\/upload$)/,express.json());

This may be a nice example to document ontheexpress.json() docs section

Metadata

Metadata

Assignees

No one assigned

    Labels

    4.xDocs for 4.x version5.xDocs for 5.x versiondocsIssues/pr concerning content

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp