Use Inbuilt body-parser (#486)

* Remove bodyParser import 

Express comes with its own version of body-parser, so we don't need to import it separately.

* Updated code to use inbuild body-parser

Co-authored-by: Tania Rascia <taniarascia@gmail.com>
This commit is contained in:
Jalaj
2021-04-01 18:53:35 +05:30
committed by GitHub
parent 69a02313a3
commit 0ddbd9c293
+1 -3
View File
@@ -2,7 +2,6 @@ import path from 'path'
import express, { Router } from 'express'
import cookieParser from 'cookie-parser'
import bodyParser from 'body-parser'
import cors from 'cors'
import helmet from 'helmet'
import compression from 'compression'
@@ -13,8 +12,7 @@ export default function initializeServer(router: Router) {
const origin = { origin: isProduction ? false : '*' }
app.set('trust proxy', 1)
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(express.json())
app.use(cookieParser())
app.use(cors(origin))
app.use(helmet())