Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
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.
 
 

27 lines
802 B

const sql = require('../utils/sql');
const blogPostRenderer = require('./renderBlogPost.js');
module.exports=
{
/**
* Renders the previews of recent blog blog and the side bar
*
* @param res
* @param fileName request url
*/
main: function(requestURL, request, templateContext)
{
var page = request.query.page;
return new Promise(function(resolve, reject)
{
sql.getRecentPostSQL().then(function(posts)
{
resolve(blogPostRenderer.renderBatchOfPosts(requestURL, posts, page, 5, templateContext));
}).catch(function(error)
{
reject(error);
})
});
}
};