From 1155bef544ef5535c1486f4b339964a04233a058 Mon Sep 17 00:00:00 2001 From: cheetah Date: Wed, 31 Mar 2021 22:02:21 +0000 Subject: [PATCH] removed body-parser package, now using express.json --- index.js | 5 ++--- package.json | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 616d065..1f752e7 100644 --- a/index.js +++ b/index.js @@ -24,10 +24,9 @@ types.DeviceRegistry.register(new types.devices.BirdySlim()) types.DeviceRegistry.register(new types.devices.Skyper()) const express = require('express') -const bodyParser = require('body-parser') const app = express() -app.use(bodyParser.json()) -/*app.get('/api/message/easy', async (req, res) => {})*/ +app.use(express.json()) + app.post('/api/message/advanced', async (req, res) => { if (!req.body.type) return res.status(500).json("ERROR: no msg type(simple,duplex)") if (!req.body.payload) return res.status(500).json("ERROR: no msg payload") diff --git a/package.json b/package.json index f7dc130..bafe5df 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "amqplib": "^0.7.0", "async-mqtt": "^2.6.1", "axios": "^0.21.1", - "body-parser": "^1.19.0", "express": "^4.17.1", "md5": "^2.3.0", "mqtt": "^4.2.6"