routes.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const writing = require("./controllers/writing.js");
  2. const travel = require("./controllers/travel.js");
  3. const learn = require("./controllers/learn.js");
  4. module.exports = function(app){
  5. let views = `${__dirname}/views`;
  6. //MAIN
  7. app.get("/", (req, res)=>{res.sendFile(`${views}/main/index.html`)});
  8. app.get("/style", (req, res)=>{res.sendFile(`${views}/main/index.css`)});
  9. //WRITING
  10. app.get("/writing/style", (req, res)=>{res.sendFile(`${views}/writing/index.css`)});
  11. app.get("/writing/code", (req, res)=>{res.sendFile(`${views}/writing/index.js`)});
  12. app.get("/writing/comments/:article", writing.getComments);
  13. app.post("/writing/comments", writing.createComment);
  14. app.get("/writing/directories", writing.listDirectories);
  15. //IMAGES
  16. app.get("/images/subline", (req, res)=>{res.sendFile(`${views}/images/subline.png`)});
  17. app.get("/images/budgeteer", (req, res)=>{res.sendFile(`${views}/images/budgeteer.jpeg`)});
  18. app.get("/images/sudoku", (req, res)=>{res.sendFile(`${views}/images/sudoku.png`)});
  19. app.get("/images/birthday", (req, res)=>{res.sendFile(`${views}/images/birthday.jpg`)});
  20. app.get("/images/market", (req, res)=>{res.sendFile(`${views}/images/market.jpeg`)});
  21. app.get("/images/web", (req, res)=>{res.sendFile(`${views}/images/webIcon.jpg`)});
  22. app.get("/images/html5", (req, res)=>{res.sendFile(`${views}/images/html5.png`)});
  23. //SUDOKU
  24. app.get("/sudoku", (req, res)=>{res.sendFile(`${views}/sudoku/index.html`)});
  25. app.get("/sudoku/style", (req, res)=>{res.sendFile(`${views}/sudoku/index.css`)});
  26. app.get("/sudoku/code", (req, res)=>{res.sendFile(`${views}/sudoku/index.js`)});
  27. //BIRTHDAY PARADOX
  28. app.get("/birthdayparadox", (req, res)=>{res.sendFile(`${views}/birthdayParadox/index.html`)});
  29. app.get("/birthdayparadox/style", (req, res)=>{res.sendFile(`${views}/birthdayParadox/index.css`)});
  30. app.get("/birthdayparadox/code", (req, res)=>{res.sendFile(`${views}/birthdayParadox/index.js`)});
  31. //TRAVEL
  32. app.get("/travel/style", (req, res)=>{res.sendFile(`${views}/travel/index.css`)});
  33. app.get("/travel/directories", travel.listDirectories);
  34. app.get("/travel/images/*", travel.getImages);
  35. app.get("/travel/*", (req, res)=>res.sendFile(`${views}/travel/index.html`));
  36. //LEARN
  37. app.get("/learn/course/new", (req, res)=>{res.sendFile(`${views}/learn/newCourse.html`)});
  38. app.post("/learn/course/new", learn.createCourse);
  39. // app.get("/learn/lecture", (req, res)=>{res.sendFile(`${views}/learn/newLecture.html`)});
  40. // app.post("/learn/lecture", (learn.createLecture));
  41. app.get("/learn/style", (req, res)=>res.sendFile(`${views}/learn/index.css`));
  42. app.get("/learn/web", (req, res)=>{res.sendFile(`${views}/learn/web.html`)});
  43. }