cube-ms
Version:
Production-ready microservice framework with health monitoring, validation, error handling, and Docker Swarm support
21 lines (17 loc) • 960 B
JavaScript
import { AuthController } from '../controllers/auth.controller.js';
/**
* Setup authentication routes
*/
export function setupAuthRoutes(service) {
const authController = new AuthController(service);
// Authentication endpoints
service.addRoute('post', '/auth/register', authController.register.bind(authController));
service.addRoute('post', '/auth/login', authController.login.bind(authController));
service.addRoute('post', '/auth/logout', authController.logout.bind(authController));
service.addRoute('post', '/auth/refresh', authController.refreshToken.bind(authController));
// Protected route example
service.addRoute('get', '/auth/profile', authController.getProfile.bind(authController));
// Password management
service.addRoute('post', '/auth/forgot-password', authController.forgotPassword.bind(authController));
service.addRoute('post', '/auth/reset-password', authController.resetPassword.bind(authController));
}