diff --git a/public/views/partials/footer.hbs b/public/views/partials/footer.hbs index 14a397c..8e499db 100644 --- a/public/views/partials/footer.hbs +++ b/public/views/partials/footer.hbs @@ -13,11 +13,11 @@ > - + - + diff --git a/src/app.js b/src/app.js index 13676fe..ea9726c 100644 --- a/src/app.js +++ b/src/app.js @@ -42,38 +42,8 @@ app.use(bodyParser.json()); // specify the usage of JSON for parsing request bod // // ***************************************************** -// initialize session variables -app.get("/welcome", (req, res) => { - res.json({ status: "success", message: "Welcome!" }); -}); -app.use( - session({ - secret: process.env.SESSION_SECRET, - saveUninitialized: false, - resave: false, - }) -); - -app.use( - bodyParser.urlencoded({ - extended: true, - }) -); -app.use(async function (req, res, next) { - res.locals.user = req.session.user; - - if (res.locals.user) { - try { - res.locals.fav_teams = await getFavoriteTeamsForUser( - res.locals.user.userid - ); - } catch (error) { - console.error("Error fetching favorite teams:", error); - } - } - - next(); -}); +const sessionConfig = require("./config/session"); // Import the hbs module +sessionConfig(app); // ***************************************************** //