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.

40 lines
996 B

  1. //file io
  2. const utils = require('../utils/utils.js');
  3. //used to parse the request URL
  4. const url = require('url');
  5. //used to append static content to result
  6. const contentLoader = require('../includes/staticContentServer.js');
  7. /**
  8. * @author Jeffery Russell 10-30-18
  9. *
  10. * @type {{main: (function(*=, *): Promise)}}
  11. */
  12. module.exports=
  13. {
  14. /**
  15. * Calls posts and sidebar modules to render blog contents in order
  16. *
  17. * @param requestURL
  18. * @returns {Promise|*}
  19. */
  20. main: function(request, result, baseURL)
  21. {
  22. var filename = url.parse(request.url, true).pathname;
  23. if(filename == baseURL || filename == baseURL.substring(0, baseURL.length - 1))
  24. {
  25. filename = baseURL + "index.html";
  26. }
  27. if (!contentLoader.serveStaticContent(request, result, filename, "/blogContent/projects"))
  28. {
  29. //do something?
  30. }
  31. }
  32. };