You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
990 B
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { Router } from "express";
import AuthController from '../controllers/AuthController.js';
import {check} from 'express-validator';
import authMiddleware from "../middlewares/authMiddleware.js";
import roleMiddleware from "../middlewares/roleMiddleware.js";
const router = new Router();
router.post('/registration',
[
check('email', "Неверный email").isEmail(),
check('name', "Не указано имя").notEmpty(),
check('sname', "Не указана фамилия").notEmpty(),
check('password', "Пароль должен быть длинною 6-20 символов").isLength({min: 6, max: 20}),
],
AuthController.register
);
router.post('/login', AuthController.login);
router.post('/confirm', AuthController.confirm);
router.get('/refresh', AuthController.refresh);
router.post('/logout', AuthController.logout);
//
//router.post('/test', roleMiddleware(['USERR', 'USER']), AuthController.test);
export default router;