summaryrefslogtreecommitdiff
path: root/routes/root.js
diff options
context:
space:
mode:
Diffstat (limited to 'routes/root.js')
-rw-r--r--routes/root.js14
1 files changed, 14 insertions, 0 deletions
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;