mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
499 B
23 lines
499 B
6 years ago
|
'use strict';
|
||
|
|
||
|
const Posts = require(__dirname+'/../../db-models/posts.js');
|
||
|
|
||
|
module.exports = async (req, res) => {
|
||
|
//get the recently bumped thread & preview posts
|
||
|
let threads;
|
||
6 years ago
|
let pages;
|
||
6 years ago
|
try {
|
||
6 years ago
|
threads = await Posts.getRecent(req.params.board, req.params.page || 1);
|
||
|
pages = Math.ceil((await Posts.getPages(req.params.board)) / 10);
|
||
6 years ago
|
} catch (err) {
|
||
|
return next(err);
|
||
|
}
|
||
|
|
||
|
//render the page
|
||
|
res.render('board', {
|
||
|
csrf: req.csrfToken(),
|
||
6 years ago
|
threads: threads || [],
|
||
|
pages: pages
|
||
6 years ago
|
});
|
||
|
}
|