Skip to content

Increasing max body size #965

Answered by RobinTail
JUNIORCO asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @JUNIORCO ,

first of all I have to mention that you can supply the JSON parser via config option jsonParser.

createConfig({
  server: {
    jsonParser: express.json({ limit: "10mb" }),
    // ...
  }
})

addExpressMiddleware might not suit here since it's being executed after parsing the body.

However, since you're also using other parsers (.urlencoded), I'd recommend going with .attachRouting() approach instead of createServer().

Thus, you can keep your original app initialization with all those limit adjustments.

Check out this chapter for more details: https://github.com/RobinTail/express-zod-api#connect-to-your-own-express-app

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by RobinTail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
good first issue Good for newcomers
2 participants