sockets work

This commit is contained in:
2024-01-23 21:17:27 -05:00
parent 375ec679f2
commit e91bb70b33
7 changed files with 37 additions and 5 deletions

View File

@ -24,8 +24,8 @@ router.get("/", async (req, res, next) => {
router.post("/new", async (req, res, next) => {
try {
const { id_sensor, id_location, sensordata } = req.body;
await addSensorData(id_sensor, id_location, sensordata);
res.sendStatus(200).json({ message: "SensorData " + id + " added" });
let data = await addSensorData(id_sensor, id_location, sensordata);
res.json({ message: "SensorData " + data.id + " added", ...data });
} catch (error) {
console.error(error);
next(error);