summaryrefslogtreecommitdiff
path: root/routes/games.js
blob: 3a27cdbfffaa5709f7b40783f456f01892fbada1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import express from "express";

import { gameId_get } from "../controllers/games/gameId.js";
import { root_get, root_post } from "../controllers/games/root.js";
import bodyParser from "../middlewares/formParser.js";
import requireAuth from "../middlewares/requireAuth.js";
import session from "../middlewares/sessions.js";
import { checkName, checkUsername } from "../utils/checks.js";

const router = express.Router();
router.use(session);
router.use(requireAuth);

router.get("/", root_get);
router.post("/", [bodyParser, checkName, checkUsername], root_post);
router.get("/:gameId(\\d+)", gameId_get);

export default router;