How to set express.json({limit: '1mb'}) on apollo server?

I have react-quill running in my app and when an image in loaded the json size exceeds the limit of body size.
The error I get is:
PayloadTooLargeError: request entity too large
I found this question which I think is related.

However, I’m not finding how to set this limit for apollo server?
I’m using createApolloServer()

import * as bodyParser from 'body-parser'

const apolloServerConfig: customApolloServerConfig = {
	configServer: (expressServer: Express): void => {
		expressServer.use(bodyParser.json({limit: '5mb'}));

createApolloServer(graphQLOptions, apolloServerConfig); // where graphQLOptions is your GraphQLOptions configuration object
1 Like