diff options
Diffstat (limited to 'src/routes')
-rw-r--r-- | src/routes/index.js | 5 |
1 files changed, 3 insertions, 2 deletions
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(); | |||
6 | 6 | ||
7 | // GET / | 7 | // GET / |
8 | router.get("/", async (req, res) => { | 8 | router.get("/", async (req, res) => { |
9 | res.redirect("/r/all"); | 9 | res.render("home"); |
10 | }); | 10 | }); |
11 | 11 | ||
12 | // GET /r/:id | 12 | // GET /r/:id |
13 | router.get("/r/:subreddit", async (req, res) => { | 13 | router.get("/r/:subreddit", async (req, res) => { |
14 | const subreddit = req.params.subreddit; | 14 | const subreddit = req.params.subreddit; |
15 | const isMulti = subreddit.includes("+"); | ||
15 | const query = req.query ? req.query : {}; | 16 | const query = req.query ? req.query : {}; |
16 | if (!query.sort) { | 17 | if (!query.sort) { |
17 | query.sort = "hot"; | 18 | query.sort = "hot"; |
@@ -22,7 +23,7 @@ router.get("/r/:subreddit", async (req, res) => { | |||
22 | 23 | ||
23 | const [posts, about] = await Promise.all([postsReq, aboutReq]); | 24 | const [posts, about] = await Promise.all([postsReq, aboutReq]); |
24 | 25 | ||
25 | res.render("index", { subreddit, posts, about, query }); | 26 | res.render("index", { subreddit, posts, about, query, isMulti }); |
26 | }); | 27 | }); |
27 | 28 | ||
28 | // GET /comments/:id | 29 | // GET /comments/:id |