From 0a6a8b150c3b0ef16afcdfd1aada51d849ca9eca Mon Sep 17 00:00:00 2001 From: fatchan Date: Wed, 27 Mar 2019 10:10:22 +0000 Subject: [PATCH] add board list page --- controllers/frontend.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/controllers/frontend.js b/controllers/frontend.js index b9a1d729..9d5eb310 100644 --- a/controllers/frontend.js +++ b/controllers/frontend.js @@ -61,7 +61,20 @@ router.get('/:board/thread/:thread([a-f\\d]{24})', Boards.exists, async (req, re }); router.get('/', async (req, res, next) => { - res.redirect('/b'); + + //get a list of boards + let boards; + try { + boards = await Boards.find(); + } catch (err) { + return next(err); + } + + //render the page + res.render('home', { + boards: boards + }); + }) module.exports = router;