From 6a15058a8811daab74de49a3a8711a4f672bd11d Mon Sep 17 00:00:00 2001 From: "gabriel.pereira" Date: Tue, 21 Oct 2025 15:55:25 -0300 Subject: [PATCH] =?UTF-8?q?REFAC:=20reorganizar=20a=20defini=C3=A7=C3=A3o?= =?UTF-8?q?=20da=20rota=20de=20redirecionamento=20na=20raiz=20para=20testa?= =?UTF-8?q?r=20se=20o=20public=20para=20de=20ser=20servido=20pelo=20nginx.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index 21cc986..9b7ba73 100644 --- a/app.js +++ b/app.js @@ -40,14 +40,6 @@ function createApp() { }) ); -// redirect raiz -app.get("/", (req, res) => { - if (req.session?.user?.authenticated) { - return res.redirect("/public/index.html"); - } - return res.redirect("/login"); -}); - // middleware que protege rotas que exigem login function requireAuth(req, res, next) { if (req.session?.user?.authenticated) { @@ -69,6 +61,14 @@ app.get("/", (req, res) => { return requireAuth(req, res, next); }); + // redirect raiz +app.get("/", (req, res) => { + if (req.session?.user?.authenticated) { + return res.redirect("/public/index.html"); + } + return res.redirect("/login"); +}); + ///////////////////////////////////////////////////// async function getMinDistance(lat, lon) {