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.

26 lines
802 B

  1. const sql = require('../utils/sql');
  2. const blogPostRenderer = require('./renderBlogPost.js');
  3. module.exports=
  4. {
  5. /**
  6. * Renders the previews of recent blog blog and the side bar
  7. *
  8. * @param res
  9. * @param fileName request url
  10. */
  11. main: function(requestURL, request, templateContext)
  12. {
  13. var page = request.query.page;
  14. return new Promise(function(resolve, reject)
  15. {
  16. sql.getRecentPostSQL().then(function(posts)
  17. {
  18. resolve(blogPostRenderer.renderBatchOfPosts(requestURL, posts, page, 5, templateContext));
  19. }).catch(function(error)
  20. {
  21. reject(error);
  22. })
  23. });
  24. }
  25. };