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.

38 lines
979 B

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