| 1 | import { Router } from "express"; |
| 2 | import { AuthController } from "../controllers/auth.controller"; |
| 3 | import { authenticate } from "../middleware/auth.middleware"; |
| 4 | import { |
| 5 | registerValidation, |
| 6 | loginValidation, |
| 7 | verifyEmailValidation, |
| 8 | resendVerificationValidation, |
| 9 | } from "../validations/auth.validation"; |
| 10 | import { validateRequest } from "../middleware/validate-request"; |
| 11 | |
| 12 | const router = Router(); |
| 13 | |
| 14 | router.post( |
| 15 | "/register", |
| 16 | registerValidation, |
| 17 | validateRequest, |
| 18 | AuthController.register |
| 19 | ); |
| 20 | router.post("/login", loginValidation, validateRequest, AuthController.login); |
| 21 | router.get( |
| 22 | "/verify-email", |
| 23 | verifyEmailValidation, |
| 24 | validateRequest, |
| 25 | AuthController.verifyEmail |
| 26 | ); |
| 27 | router.post( |
| 28 | "/resend-verification", |
| 29 | resendVerificationValidation, |
| 30 | validateRequest, |
| 31 | AuthController.resendVerificationEmail |
| 32 | ); |
| 33 | router.get("/me", authenticate, AuthController.getProfile); |
| 34 | |
| 35 | export default router; |