From 12dc98694184815d1afefb028a32376213f459c3 Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Sat, 24 Jun 2023 19:52:41 +0300 Subject: [PATCH] authenticateToken --- src/routes/userRouter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/userRouter.ts b/src/routes/userRouter.ts index 77ae7e2..bbfd01a 100644 --- a/src/routes/userRouter.ts +++ b/src/routes/userRouter.ts @@ -1,6 +1,7 @@ import express from 'express'; import { create, login, logout, getAll, deleteHandler } from '../controllers/UserController'; import { isValidCreateUser, isValidLogin } from '../middlewares/usersResourceValidation'; +import { authenticateToken } from '../middlewares/checkAuth'; const userRouter = express.Router(); @@ -8,6 +9,6 @@ userRouter.post('/', isValidCreateUser, create); userRouter.get('/', getAll); userRouter.post('/login', isValidLogin, login); userRouter.post('/logout', logout); -userRouter.delete('/:id', deleteHandler) +userRouter.delete('/:id', authenticateToken ,deleteHandler) export default userRouter; \ No newline at end of file