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.

29 lines
686 B

  1. const routes = require('express').Router();
  2. const url = require('url');
  3. const contentLoader = require('../../includes/staticContentServer.js');
  4. routes.get('*', (request, result) =>
  5. {
  6. var filename = url.parse(request.url, true).pathname;
  7. var extra = '';
  8. if(filename === '/')
  9. {
  10. if(request.originalUrl.charAt(request.originalUrl.length -1) !== '/')
  11. {
  12. result.redirect(request.originalUrl + "/");
  13. }
  14. else
  15. {
  16. extra = "/index.html";
  17. }
  18. }
  19. if(!contentLoader.serveStaticContent(request, result,
  20. request.originalUrl + extra, "blogContent/projects"))
  21. {
  22. }
  23. });
  24. module.exports = routes;