diff --git a/api/src/app.ts b/api/src/app.ts index 2f538a7a..b79eb909 100644 --- a/api/src/app.ts +++ b/api/src/app.ts @@ -7,6 +7,7 @@ import { } from 'graphql-playground-html' import * as Sentry from "@sentry/node"; import { nodeProfilingIntegration } from "@sentry/profiling-node"; +import bodyParser from 'body-parser'; const logger = getChildLogger({ msgPrefix: 'APP' }); @@ -17,6 +18,11 @@ export const createApp = (): { app: Express, router: express.Router } => { const app = express(); const router = express.Router(); + // fixes request entity too large + app.use(bodyParser.json({ limit: "50mb" })); + app.use(bodyParser.urlencoded({ limit: "50mb", extended: true, parameterLimit: 50000 })); + + if (process.env.SENTRY_DSN) { Sentry.init({ dsn: process.env.SENTRY_DSN, diff --git a/api/src/graphql/server/index.ts b/api/src/graphql/server/index.ts index 9b07aa67..539621ee 100644 --- a/api/src/graphql/server/index.ts +++ b/api/src/graphql/server/index.ts @@ -2,7 +2,6 @@ import type express from 'express'; import { ApolloServerPlugin, ApolloServer } from '@apollo/server'; import { expressMiddleware } from '@apollo/server/express4'; -import bodyParser from 'body-parser'; import cookierParser from 'cookie-parser'; import cors from 'cors'; import { schemaWithMiddleware as indexSchema } from './index/schema'; @@ -45,11 +44,6 @@ export const addGraphqlRoutes = async ( await apolloIndex.start(); await apolloDrive.start(); - // fixes request entity too large - router.use(bodyParser.json({ limit: "50mb" })); - router.use(bodyParser.urlencoded({ limit: "50mb", extended: true, parameterLimit: 50000 })); - - router.use( '/drives', cors(),