mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
add back json body parsing
This commit is contained in:
@@ -9,8 +9,8 @@ const rest_server = express();
|
||||
const port = 3080;
|
||||
|
||||
rest_server.use(compression());
|
||||
// rest_server.use(express.static(path.join(__dirname, '../interface/build')));
|
||||
// rest_server.use(express.json());
|
||||
rest_server.use(express.static(path.join(__dirname, '../interface/build')));
|
||||
rest_server.use(express.json());
|
||||
|
||||
// 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) => {
|
||||
console.log(req.body);
|
||||
const devicevalue = req.body.devicevalue;
|
||||
const id = req.body.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;
|
||||
}
|
||||
|
||||
// await delay(2000); // wait 2 seconds to show spinner
|
||||
await delay(1000); // wait to show spinner
|
||||
// res.sendStatus(400); // bad request
|
||||
|
||||
res.sendStatus(200);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user