Skip to content

Commit

Permalink
chore: move bodyParser to createApp fn
Browse files Browse the repository at this point in the history
  • Loading branch information
froid1911 committed May 16, 2024
1 parent d5176b0 commit 8d985b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 6 additions & 0 deletions api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand All @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions api/src/graphql/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<cors.CorsRequest>(),
Expand Down

0 comments on commit 8d985b6

Please sign in to comment.