var express = require('express');
var router = express.Router();

const userControoller = require('../controllers/userController');
const { authMiddleware } = require('../middlewares/authMiddleware');
const { loginLimiter } = require('../middlewares/rateLimiter');

router.post('/create', userControoller.validateAdd, userControoller.register);
router.post('/login', loginLimiter, userControoller.validateLogin, userControoller.login);
router.put('/update', authMiddleware, userControoller.validateUpdate, userControoller.update);
router.delete('/:id', authMiddleware, userControoller.destroy);
router.get('/get', authMiddleware, userControoller.get);
router.get('/role/:name', authMiddleware, userControoller.getrole);

module.exports = router;
