mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 04:50:12 +02:00
31 lines
759 B
TypeScript
31 lines
759 B
TypeScript
import express, { Router } from 'express';
|
|
import passport from 'passport';
|
|
import { controller } from '@controllers/index';
|
|
import { authenticate } from '@middleware/authenticate';
|
|
import { validation, validateRequest } from '@validations/index';
|
|
|
|
export const router: Router = express.Router({ mergeParams: true });
|
|
|
|
router.post(
|
|
'/login',
|
|
validateRequest(validation.auth.login),
|
|
passport.authenticate('local'),
|
|
controller.auth.login
|
|
);
|
|
|
|
router.post(
|
|
'/register',
|
|
validateRequest(validation.auth.register),
|
|
controller.auth.register
|
|
);
|
|
|
|
router.post('/logout', authenticate, controller.auth.logout);
|
|
|
|
router.post(
|
|
'/refresh',
|
|
validateRequest(validation.auth.refresh),
|
|
controller.auth.refresh
|
|
);
|
|
|
|
router.get('/ping', controller.auth.ping);
|