auth.routes.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const asyncHandler = require("express-async-handler");
  2. const { Router } = require("express");
  3. const validators = require("../handlers/validators.handler");
  4. const helpers = require("../handlers/helpers.handler");
  5. const auth = require("../handlers/auth.handler");
  6. const router = Router();
  7. router.post(
  8. "/login",
  9. helpers.viewTemplate("partials/auth/form"),
  10. validators.login,
  11. asyncHandler(helpers.verify),
  12. asyncHandler(auth.local),
  13. asyncHandler(auth.login)
  14. );
  15. router.post(
  16. "/signup",
  17. helpers.viewTemplate("partials/auth/form"),
  18. auth.signupAccess,
  19. validators.signup,
  20. asyncHandler(helpers.verify),
  21. asyncHandler(auth.signup)
  22. );
  23. // router.post("/renew", asyncHandler(auth.jwt), asyncHandler(auth.token));
  24. // router.post(
  25. // "/change-password",
  26. // asyncHandler(auth.jwt),
  27. // validators.changePassword,
  28. // asyncHandler(helpers.verify),
  29. // asyncHandler(auth.changePassword)
  30. // );
  31. // router.post(
  32. // "/change-email",
  33. // asyncHandler(auth.jwt),
  34. // validators.changePassword,
  35. // asyncHandler(helpers.verify),
  36. // asyncHandler(auth.changeEmailRequest)
  37. // );
  38. // router.post(
  39. // "/apikey",
  40. // asyncHandler(auth.jwt),
  41. // asyncHandler(auth.generateApiKey)
  42. // );
  43. // router.post("/reset-password", asyncHandler(auth.resetPasswordRequest));
  44. module.exports = router;