diff --git a/package-lock.json b/package-lock.json index 927320c..4282860 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,6 @@ "dependencies": { "@apollo/server": "^4.1.0", "@types/mongoose": "^5.7.16", - "body-parser": "^1.20.1", "cors": "^2.8.5", "dotenv": "^8.2.0", "express": "^4.18.2", diff --git a/package.json b/package.json index 9b490a8..7219527 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "dependencies": { "@apollo/server": "^4.1.0", "@types/mongoose": "^5.7.16", - "body-parser": "^1.20.1", "cors": "^2.8.5", "dotenv": "^8.2.0", "express": "^4.18.2", diff --git a/src/bootstrap/index.ts b/src/bootstrap/index.ts index 8f66054..793649c 100644 --- a/src/bootstrap/index.ts +++ b/src/bootstrap/index.ts @@ -1,5 +1,4 @@ -import express, { json } from "express"; -import cors from "cors"; +import express from "express"; import { expressMiddleware } from "@apollo/server/express4"; import loaders from "./loaders"; import { Config } from "../config"; @@ -13,7 +12,6 @@ export default async (config: Config) => { app.use( "/graphql", - json(), expressMiddleware(server, { context: async ({ req }) => ({ token: req.headers.token }), }) diff --git a/src/bootstrap/loaders/express.ts b/src/bootstrap/loaders/express.ts index 54d3679..a63e026 100644 --- a/src/bootstrap/loaders/express.ts +++ b/src/bootstrap/loaders/express.ts @@ -1,5 +1,4 @@ -import express from "express"; -import bodyParser from "body-parser"; +import express, { json } from "express"; import cors from "cors"; import helmet from "helmet"; @@ -7,7 +6,7 @@ import { config } from "../../config"; export default async (app: express.Application) => { // Body parser only needed during POST on the graphQL path - app.use(config.graphqlPath, bodyParser.json()); + app.use(config.graphqlPath, json()); // Cors configuration app.use(cors());