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.

37 lines
878 B

  1. const routes = require('express').Router();
  2. const analytics = require('./analytics');
  3. routes.use('/analytics', analytics);
  4. const login = require('./login');
  5. routes.use('/login', login);
  6. const posts = require('./posts');
  7. routes.use('/posts', posts);
  8. const downloads = require('./downloads');
  9. routes.use('/downloads', downloads);
  10. const users = require('./users');
  11. routes.use('/users', users);
  12. const builder = require('../../utils/pageBuilder.js');
  13. routes.get('/', (request, result) =>
  14. {
  15. builder.constructAdminPage(request, result, require("../../admin/adminHome").main)
  16. });
  17. routes.post('/', (request, result) =>
  18. {
  19. builder.adminPostRoute(request, require("../../admin/adminHome").processPostData).then(function()
  20. {
  21. result.redirect("/admin");
  22. });
  23. });
  24. routes.get('*', (request, result) =>
  25. {
  26. builder.print404(result);
  27. });
  28. module.exports = routes;