From 47b4fd3b1233353e56c99c0b9a5a8633d8bc2617 Mon Sep 17 00:00:00 2001 From: Akshay Date: Tue, 5 Nov 2024 22:44:56 +0000 Subject: subs as home page --- src/routes/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/routes/index.js') diff --git a/src/routes/index.js b/src/routes/index.js index f60fd96..7fe9e2a 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -6,12 +6,13 @@ const G = new geddit.Geddit(); // GET / router.get("/", async (req, res) => { - res.redirect("/r/all"); + res.render("home"); }); // GET /r/:id router.get("/r/:subreddit", async (req, res) => { const subreddit = req.params.subreddit; + const isMulti = subreddit.includes("+"); const query = req.query ? req.query : {}; if (!query.sort) { query.sort = "hot"; @@ -22,7 +23,7 @@ router.get("/r/:subreddit", async (req, res) => { const [posts, about] = await Promise.all([postsReq, aboutReq]); - res.render("index", { subreddit, posts, about, query }); + res.render("index", { subreddit, posts, about, query, isMulti }); }); // GET /comments/:id -- cgit v1.2.3