From 8ac636186cf5f704264e7473864c54b3edaf4049 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 21 Nov 2022 21:39:17 +0100 Subject: Added basic games handling --- controllers/games/gameId.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 controllers/games/gameId.js (limited to 'controllers/games/gameId.js') 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)); +} -- cgit v1.2.3