removed body-parser package, now using express.json

master
cheetah 4 years ago
parent 8ea029fec2
commit 1155bef544

@ -24,10 +24,9 @@ types.DeviceRegistry.register(new types.devices.BirdySlim())
types.DeviceRegistry.register(new types.devices.Skyper()) types.DeviceRegistry.register(new types.devices.Skyper())
const express = require('express') const express = require('express')
const bodyParser = require('body-parser')
const app = express() const app = express()
app.use(bodyParser.json()) app.use(express.json())
/*app.get('/api/message/easy', async (req, res) => {})*/
app.post('/api/message/advanced', async (req, res) => { 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.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") if (!req.body.payload) return res.status(500).json("ERROR: no msg payload")

@ -22,7 +22,6 @@
"amqplib": "^0.7.0", "amqplib": "^0.7.0",
"async-mqtt": "^2.6.1", "async-mqtt": "^2.6.1",
"axios": "^0.21.1", "axios": "^0.21.1",
"body-parser": "^1.19.0",
"express": "^4.17.1", "express": "^4.17.1",
"md5": "^2.3.0", "md5": "^2.3.0",
"mqtt": "^4.2.6" "mqtt": "^4.2.6"

Loading…
Cancel
Save