feat: initialize sensors database table and index on server startup

This commit is contained in:
Giuseppe Raffa
2026-04-06 11:47:54 +02:00
parent e65f2ba3a0
commit f785fbedca
2 changed files with 23 additions and 3 deletions

View File

@@ -76,10 +76,11 @@ app.get('/sessions/:sensorId/csv', async (req, res) => {
}
});
// --- HTTP server + WebSocket per watchers live ---
const server = app.listen(process.env.PORT, '0.0.0.0', () => {
console.log(`Realtime on port ${process.env.PORT}`);
const PORT = process.env.PORT || 3000;
const server = app.listen(PORT, '0.0.0.0', async () => {
console.log(`Realtime on port ${PORT}`);
await require('./helper/authdb').initDB();
});
const wss = new WebSocket.Server({ server, path: '/live' });