From 21f816aedc831cd55264afb761dfc50ba95644e9 Mon Sep 17 00:00:00 2001 From: rehabas Date: Sat, 28 Mar 2020 12:36:19 +0300 Subject: [PATCH 1/2] add body-parser as middleware relates #37 --- package.json | 1 + server/app.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 77d2f632..0a377503 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "dependencies": { "babel-jest": "^24.9.0", "bcrypt": "^4.0.1", + "body-parser": "^1.19.0", "compression": "^1.7.4", "cookie-parser": "^1.4.5", "dotenv": "^8.2.0", diff --git a/server/app.js b/server/app.js index 1dcebe81..236cb2fe 100644 --- a/server/app.js +++ b/server/app.js @@ -1,11 +1,12 @@ const express = require('express'); const compression = require('compression'); const { join } = require('path'); +const bodyParser = require('body-parser'); const controller = require('./controllers'); const app = express(); - +app.use(bodyParser.urlencoded({ extended: false })); app.disable('x-powered-by'); app.set('port', process.env.PORT || 5000); From 8d66c4cf965bd8587c9f4ce9c36698cf4ea731a4 Mon Sep 17 00:00:00 2001 From: rehabas Date: Sat, 28 Mar 2020 13:05:46 +0300 Subject: [PATCH 2/2] add express.urlencoded as a middleware relates #37 --- package.json | 1 - server/app.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 0a377503..77d2f632 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "dependencies": { "babel-jest": "^24.9.0", "bcrypt": "^4.0.1", - "body-parser": "^1.19.0", "compression": "^1.7.4", "cookie-parser": "^1.4.5", "dotenv": "^8.2.0", diff --git a/server/app.js b/server/app.js index 236cb2fe..50f64949 100644 --- a/server/app.js +++ b/server/app.js @@ -1,16 +1,16 @@ const express = require('express'); const compression = require('compression'); const { join } = require('path'); -const bodyParser = require('body-parser'); const controller = require('./controllers'); const app = express(); -app.use(bodyParser.urlencoded({ extended: false })); + app.disable('x-powered-by'); app.set('port', process.env.PORT || 5000); app.use(express.json()); +app.use(express.urlencoded({ extended: false })); app.use(compression()); app.use('/api/v1/', controller);