add back json body parsing

This commit is contained in:
Proddy
2023-07-03 09:59:52 +02:00
parent 50b8db0c96
commit 2ad375884f

View File

@@ -9,8 +9,8 @@ const rest_server = express();
const port = 3080; const port = 3080;
rest_server.use(compression()); rest_server.use(compression());
// rest_server.use(express.static(path.join(__dirname, '../interface/build'))); rest_server.use(express.static(path.join(__dirname, '../interface/build')));
// rest_server.use(express.json()); rest_server.use(express.json());
// uploads // uploads
const upload = multer({ dest: '../mock-api/uploads' }); const upload = multer({ dest: '../mock-api/uploads' });
@@ -2397,7 +2397,6 @@ rest_server.post(EMSESP_WRITE_ENTITIES_ENDPOINT, (req, res) => {
}); });
rest_server.post(EMSESP_WRITE_VALUE_ENDPOINT, async (req, res) => { rest_server.post(EMSESP_WRITE_VALUE_ENDPOINT, async (req, res) => {
console.log(req.body);
const devicevalue = req.body.devicevalue; const devicevalue = req.body.devicevalue;
const id = req.body.id; const id = req.body.id;
console.log('Write device value for id : ' + id); console.log('Write device value for id : ' + id);
@@ -2436,8 +2435,9 @@ rest_server.post(EMSESP_WRITE_VALUE_ENDPOINT, async (req, res) => {
emsesp_devicedata_99.data[objIndex] = devicevalue; emsesp_devicedata_99.data[objIndex] = devicevalue;
} }
// await delay(2000); // wait 2 seconds to show spinner await delay(1000); // wait to show spinner
// res.sendStatus(400); // bad request // res.sendStatus(400); // bad request
res.sendStatus(200); res.sendStatus(200);
}); });