summaryrefslogtreecommitdiff
path: root/controllers/games/gameId.js
diff options
context:
space:
mode:
authorJulien Dessaux2022-11-21 21:39:17 +0100
committerJulien Dessaux2022-11-21 21:39:17 +0100
commit8ac636186cf5f704264e7473864c54b3edaf4049 (patch)
tree6f575d5b4dc5afc0c087e0467c4dd7d6e4a6dd6b /controllers/games/gameId.js
parentcleaned up the distinction between routes and controllers (diff)
downloadjeux-de-mots-8ac636186cf5f704264e7473864c54b3edaf4049.tar.gz
jeux-de-mots-8ac636186cf5f704264e7473864c54b3edaf4049.tar.bz2
jeux-de-mots-8ac636186cf5f704264e7473864c54b3edaf4049.zip
Added basic games handling
Diffstat (limited to 'controllers/games/gameId.js')
-rw-r--r--controllers/games/gameId.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/controllers/games/gameId.js b/controllers/games/gameId.js
new file mode 100644
index 0000000..c87a857
--- /dev/null
+++ b/controllers/games/gameId.js
@@ -0,0 +1,17 @@
+import { getGame } from "../../database/games.js";
+
+function makePageData(user, cwdata) {
+ return {
+ title: "Jouer",
+ user: user,
+ CWDATA: cwdata,
+ };
+}
+
+export function gameId_get(req, res) {
+ const game = getGame(req.params.gameId);
+ // TODO redirect if null
+ let cwdata = game; // TODO reformat this object
+ console.log(cwdata);
+ return res.render("game", makePageData(req.session.user, cwdata));
+}