reset: removed the old code to start from scratch

This commit is contained in:
Giuseppe Raffa
2026-04-14 15:56:24 +02:00
parent c597d4a414
commit c478f5c13c
11 changed files with 3 additions and 904 deletions

View File

@@ -1,36 +0,0 @@
const express = require('express');
const redis = require('../helper/redis');
const router = express.Router();
/**
* GET /sessions
* Ritorna tutti i sensori attualmente connessi con i loro metadati.
* Se viene passato un parametro ?sensor=ID, restituisce solo quello.
*/
router.get('/', async (req, res) => {
const { sensor } = req.query;
// Se viene passato un parametro ?sensor=ID, restituiamo solo quello
if (sensor) {
try {
const session = await redis.getSession(sensor);
if (!session) {
return res.status(404).json({ error: 'Session not found' });
}
return res.status(200).json(JSON.parse(session));
} catch (error) {
return res.status(500).json({ error: `${error}` });
}
}
// Altrimenti restituiamo tutta la lista
try {
const sessions = await redis.getSessions();
res.status(200).json(sessions);
} catch (error) {
res.status(500).json({ error: `${error}` });
}
});
module.exports = router;