further incomplete redis draft

This commit is contained in:
AlecM33
2023-01-10 21:33:24 -05:00
parent 7d24916eed
commit a0607d2c9a
9 changed files with 251 additions and 144 deletions

View File

@@ -20,11 +20,11 @@ router.post('/sockets/broadcast', function (req, res) {
res.status(201).send('Broadcasted message to all connected sockets: ' + req.body?.message);
});
router.get('/games/state', function (req, res) {
router.get('/games/state', async (req, res) => {
const gamesArray = [];
for (const key of gameManager.activeGameRunner.activeGames.keys()) {
gamesArray.push(gameManager.activeGameRunner.activeGames.get(key));
}
await this.client.hGetAll('activeGames').then(async (r) => {
Object.values(r).forEach((v) => gamesArray.push(v));
});
res.status(200).send(gamesArray);
});