authenticateToken

This commit is contained in:
Kfir Dayan 2023-06-24 19:52:41 +03:00
parent 35ca5e7e45
commit 12dc986941

View file

@ -1,6 +1,7 @@
import express from 'express'; import express from 'express';
import { create, login, logout, getAll, deleteHandler } from '../controllers/UserController'; import { create, login, logout, getAll, deleteHandler } from '../controllers/UserController';
import { isValidCreateUser, isValidLogin } from '../middlewares/usersResourceValidation'; import { isValidCreateUser, isValidLogin } from '../middlewares/usersResourceValidation';
import { authenticateToken } from '../middlewares/checkAuth';
const userRouter = express.Router(); const userRouter = express.Router();
@ -8,6 +9,6 @@ userRouter.post('/', isValidCreateUser, create);
userRouter.get('/', getAll); userRouter.get('/', getAll);
userRouter.post('/login', isValidLogin, login); userRouter.post('/login', isValidLogin, login);
userRouter.post('/logout', logout); userRouter.post('/logout', logout);
userRouter.delete('/:id', deleteHandler) userRouter.delete('/:id', authenticateToken ,deleteHandler)
export default userRouter; export default userRouter;