Files
payload/docs/Configuration/express.mdx

35 lines
1.2 KiB
Plaintext

---
title: Express
label: Express
order: 60
---
Payload utilizes a few Express-specific middleware packages within its own routers. You can customize how they work by passing in configuration options to the main Payload config's `express` property.
### JSON
`express.json()` is used to parse JSON body content into JavaScript objects accessible on the Express `req`. Payload allows you to customize all of the `json` method's options. Common examples of customization use-cases are if your JSON body exceeds the default of `2MB` in size.
**Example config for how to increase the max JSON size allowed to be sent to Payload endpoints:**
```js
{
serverURL: 'http://localhost:3000',
express: {
json: {
limit: '4mb',
}
}
}
```
You can find a list of all available options that are able to be passed to `express.json()` [here](https://expressjs.com/en/api.html).
### Compression
Payload uses the `compression` package to optimize transfer size for all of the routes it opens, and you can pass customization options through the Payload config. Typically, the default options for this package are suitable.
However, for a list of all available customization options, [click here](http://expressjs.com/en/resources/middleware/compression.html).