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.

34 lines
747 B

  1. var http = require('http');
  2. const url = require('url');
  3. const fs = require('fs');
  4. const utils = require('./utils.js');
  5. const includes = require('./includes.js');
  6. http.createServer(function (req, res)
  7. {
  8. var q = url.parse(req.url, true);
  9. var filename = "." + q.pathname;
  10. //prints header
  11. includes.printHeader(res);
  12. utils.include(res, "README.md");
  13. if(filename.includes("/category"))
  14. {
  15. console.log("categories");
  16. test();
  17. }
  18. else if(filename.includes("/posts/"))
  19. {
  20. console.log("posts");
  21. }
  22. else if(filename.includes("/downloads/"))
  23. {
  24. console.log("downloads");
  25. }
  26. else
  27. {
  28. console.log("default");
  29. }
  30. includes.printFooter(res);
  31. }).listen(8080);