From 2611ded920a8345922346ed0d43e4efdd94401a1 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 27 Oct 2022 23:56:29 +0200 Subject: Began implementing middlewares, session and auth --- routes/root.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 routes/root.js (limited to 'routes/root.js') diff --git a/routes/root.js b/routes/root.js new file mode 100644 index 0000000..be3681a --- /dev/null +++ b/routes/root.js @@ -0,0 +1,14 @@ +import express from "express"; + +import session from "../middlewares/sessions.js"; + +const router = express.Router(); +router.use(session); +router.get("/", (req, res) => { + if (session.loggedIn) { + return res.redirect(302, "/play"); + } + return res.redirect(302, "/login"); +}); + +export default router; -- cgit v1.2.3