diff options
author | Julien Dessaux | 2022-10-27 23:56:29 +0200 |
---|---|---|
committer | Julien Dessaux | 2022-10-27 23:56:29 +0200 |
commit | 2611ded920a8345922346ed0d43e4efdd94401a1 (patch) | |
tree | 3313d976fbb11bdbfd1841ce336cc4372f9ab32c /routes/root.js | |
parent | Allow for placing the first word (diff) | |
download | jeux-de-mots-2611ded920a8345922346ed0d43e4efdd94401a1.tar.gz jeux-de-mots-2611ded920a8345922346ed0d43e4efdd94401a1.tar.bz2 jeux-de-mots-2611ded920a8345922346ed0d43e4efdd94401a1.zip |
Began implementing middlewares, session and auth
Diffstat (limited to 'routes/root.js')
-rw-r--r-- | routes/root.js | 14 |
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; |