From 4bc5d00344f0135fabc636d068193c8451ca213c Mon Sep 17 00:00:00 2001 From: flifloo Date: Mon, 14 Dec 2020 22:43:08 +0100 Subject: [PATCH] Fix routes --- app.js | 2 -- routes/edt.js | 3 ++- routes/home.js | 9 --------- routes/marks.js | 3 ++- routes/profil.js | 3 ++- routes/viescol.js | 3 ++- 6 files changed, 8 insertions(+), 15 deletions(-) delete mode 100644 routes/home.js diff --git a/app.js b/app.js index caba270..3b56354 100644 --- a/app.js +++ b/app.js @@ -9,7 +9,6 @@ let config = process.env.NODE_ENV === "test" ? {} : require("./config/config.jso let indexRouter = require("./routes/index"); const loginRouter = require("./routes/login"); const edtRouter = require("./routes/edt"); -const homeRouter = require("./routes/home"); const marksRouter = require("./routes/marks"); const registerRouter = require("./routes/register"); const viescolRouter = require("./routes/viescol"); @@ -41,7 +40,6 @@ app.use("/", indexRouter); app.use("/login", loginRouter); app.use("/email", require("./routes/email")); app.use("/edt", edtRouter); -app.use("/home", homeRouter); app.use("/marks", marksRouter); app.use('/register', registerRouter); app.use('/viescol', viescolRouter); diff --git a/routes/edt.js b/routes/edt.js index 753a638..8b9291c 100644 --- a/routes/edt.js +++ b/routes/edt.js @@ -1,7 +1,8 @@ const express = require("express"); +const sessionCheck = require("./utils/sessionCheck"); const router = express.Router(); -router.get("/", (req, res) => { +router.get("/", sessionCheck(1), (req, res) => { res.render("pages/edt", { title: "L'ETU" }); }); diff --git a/routes/home.js b/routes/home.js deleted file mode 100644 index 0e85584..0000000 --- a/routes/home.js +++ /dev/null @@ -1,9 +0,0 @@ -const express = require("express"); -const router = express.Router(); - -/* GET home page. */ -router.get("/", (req, res) => { - res.render("pages/home", { title: "L'ETU" }); -}); - -module.exports = router; diff --git a/routes/marks.js b/routes/marks.js index db46ce0..8b3338a 100644 --- a/routes/marks.js +++ b/routes/marks.js @@ -1,7 +1,8 @@ const express = require("express"); +const sessionCheck = require("./utils/sessionCheck"); const router = express.Router(); -router.get("/", (req, res) => { +router.get("/", sessionCheck(1), (req, res) => { res.render("pages/marks", { title: "L'ETU" }); }); diff --git a/routes/profil.js b/routes/profil.js index 82c23b8..3b0066b 100644 --- a/routes/profil.js +++ b/routes/profil.js @@ -1,7 +1,8 @@ const express = require("express"); +const sessionCheck = require("./utils/sessionCheck"); const router = express.Router(); -router.get("/", (req, res) => { +router.get("/", sessionCheck(1), (req, res) => { res.render("pages/profil", { title: "L'ETU" }); }); diff --git a/routes/viescol.js b/routes/viescol.js index e846717..4bd1b47 100644 --- a/routes/viescol.js +++ b/routes/viescol.js @@ -1,7 +1,8 @@ const express = require("express"); +const sessionCheck = require("./utils/sessionCheck"); const router = express.Router(); -router.get("/", (req, res) => { +router.get("/", sessionCheck(1), (req, res) => { res.render("pages/viescol", { title: "L'ETU" }); });