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.

41 lines
922 B

  1. /**
  2. * Main server file for the blog. This file is responsible for
  3. * creating the server and listening for clients. The main run
  4. * function parses the url and calls a sub module to make the
  5. * appropriate pages.
  6. */
  7. const http = require('http');
  8. const url = require('url');
  9. const includes = require('./includes/includes.js');
  10. http.createServer(function (req, res)
  11. {
  12. var q = url.parse(req.url, true);
  13. var filename = "." + q.pathname;
  14. //prints header
  15. includes.printHeader(res);
  16. if(filename.includes("/category"))
  17. {
  18. //categories or view a category page
  19. }
  20. else if(filename.includes("/downloads/"))
  21. {
  22. //downloads page
  23. //probably will be implemented later
  24. }
  25. else if(filename.includes("/admin"))
  26. {
  27. //admin page
  28. }
  29. else
  30. {
  31. //normal blog entry
  32. }
  33. //includes footer file
  34. includes.printFooter(res);
  35. }).listen(8080);