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.

72 lines
1.7 KiB

  1. const routes = require('express').Router();
  2. // /** about page */
  3. // const about = require('./about');
  4. // routes.use('/about', about);
  5. /** admin page and all of its sub pages */
  6. const admin = require('./admin');
  7. routes.use('/admin', admin);
  8. /** Contact page */
  9. const contact = require('./contact');
  10. routes.use('/contact', contact);
  11. /** Downloads path for files */
  12. const downloads = require('./downloads');
  13. routes.use('/downloads', downloads);
  14. /** static content like css, js, and images */
  15. const includes = require('./includes');
  16. routes.use('/includes', includes);
  17. routes.use('/blogContent', includes);
  18. routes.use('/sitemap.txt', includes);
  19. routes.use('/robots.txt', includes);
  20. const photosPages = require('./photos');
  21. routes.use('/photos', photosPages);
  22. /** category pages */
  23. const category = require('./category');
  24. routes.use('/category', category);
  25. const pageBuilder = require('../utils/pageBuilder');
  26. routes.get('/about', (request, result) =>
  27. {
  28. pageBuilder.buildPageWithTemplate(request, result,
  29. (p1,p2,p3)=>{}, "blog/about.html");
  30. });
  31. routes.get('/posts', (request, result) =>
  32. {
  33. pageBuilder.buildPageWithTemplate(request, result,
  34. (p1,p2,p3)=>{}, "blog/posts.html");
  35. });
  36. const project = require('./projects');
  37. routes.use('/steam', project);
  38. const api = require('./api');
  39. routes.use('/api', api);
  40. const feed = require('./rss');
  41. routes.use('/rss', feed);
  42. //blog home page
  43. routes.get('/', (request, result) =>
  44. {
  45. pageBuilder.buildBlogPage(request, result, require("../blog/homePage").main)
  46. });
  47. //regular blog posts
  48. routes.get('*', (request, result) =>
  49. {
  50. pageBuilder.buildBlogPage(request, result,
  51. require("../blog/posts").main, request.url);
  52. });
  53. module.exports = routes;