diff options
author | Julien Dessaux | 2022-11-21 21:39:17 +0100 |
---|---|---|
committer | Julien Dessaux | 2022-11-21 21:39:17 +0100 |
commit | 8ac636186cf5f704264e7473864c54b3edaf4049 (patch) | |
tree | 6f575d5b4dc5afc0c087e0467c4dd7d6e4a6dd6b /controllers/games/root.js | |
parent | cleaned up the distinction between routes and controllers (diff) | |
download | jeux-de-mots-8ac636186cf5f704264e7473864c54b3edaf4049.tar.gz jeux-de-mots-8ac636186cf5f704264e7473864c54b3edaf4049.tar.bz2 jeux-de-mots-8ac636186cf5f704264e7473864c54b3edaf4049.zip |
Added basic games handling
Diffstat (limited to '')
-rw-r--r-- | controllers/games/root.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/controllers/games/root.js b/controllers/games/root.js new file mode 100644 index 0000000..ece7b74 --- /dev/null +++ b/controllers/games/root.js @@ -0,0 +1,13 @@ +import { listGames } from "../../database/games.js"; + +export function root_get(req, res) { + const data = { + title: "Liste des parties", + user: req.session.user, + games: listGames(req.session.user.id), + }; + for (let i=0; i<data.games.length; i++) { + data.games[i].data = JSON.parse(data.games[i].data); + } + return res.render("games", data); +} |