summaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
authorJulien Dessaux2022-11-21 21:39:17 +0100
committerJulien Dessaux2022-11-21 21:39:17 +0100
commit8ac636186cf5f704264e7473864c54b3edaf4049 (patch)
tree6f575d5b4dc5afc0c087e0467c4dd7d6e4a6dd6b /routes
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 '')
-rw-r--r--routes/games.js15
-rw-r--r--routes/play.js35
2 files changed, 15 insertions, 35 deletions
diff --git a/routes/games.js b/routes/games.js
new file mode 100644
index 0000000..67d105d
--- /dev/null
+++ b/routes/games.js
@@ -0,0 +1,15 @@
+import express from "express";
+
+import { gameId_get } from "../controllers/games/gameId.js";
+import { root_get } from "../controllers/games/root.js";
+import requireAuth from "../middlewares/requireAuth.js";
+import session from "../middlewares/sessions.js";
+
+const router = express.Router();
+router.use(session);
+router.use(requireAuth);
+
+router.get("/", root_get);
+router.get("/:gameId(\\d+)", gameId_get);
+
+export default router;
diff --git a/routes/play.js b/routes/play.js
deleted file mode 100644
index 4db9acd..0000000
--- a/routes/play.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import express from "express";
-
-import makePlayController from "../controllers/play.js";
-import requireAuth from "../middlewares/requireAuth.js";
-import session from "../middlewares/sessions.js";
-
-const router = express.Router();
-router.use(session);
-router.use(requireAuth);
-
-router.get("/", (req, res) => {
- const cwdata = {
- board: [
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ],
- [ "", "", "", "", "","", "", "", "", "", "", "", "", "", "" ]
- ],
- letters: [ "A", "B", "C", "D", "E", "F", "JOKER" ]
- };
- return res.render("play", makePlayController(req, cwdata));
-});
-
-export default router;