123456789101112131415161718192021222324252627282930 |
- const express = require('express');
- const router = express.Router();
- const controllers = require('../controllers/user');
- const validation = require('../validation/user');
- const guard = require('../helpers/guard');
- const upload = require('../helpers/upload');
- router
- .post('/auth/register', validation.registration, controllers.createNewUser)
- .patch('/auth/login', validation.logIn, controllers.logIn)
- .patch('/auth/logout', guard, controllers.logOut)
- .patch('/auth/online', guard, controllers.online)
- .patch(
- '/users/current/credentials',
- [guard, validation.updateCredentials],
- controllers.updateCredentials
- )
- .get('/users/current', guard, controllers.getCurrent)
- .patch(
- '/users/avatars',
- [guard, upload.uploadImage.single('avatar'), validation.validateUploadFile],
- controllers.updateAvatar
- )
- .patch(
- '/users/current/update',
- [guard, validation.updateUser],
- controllers.updateUser
- )
- .delete('/users/current/:index', guard, controllers.removeAvatar);
- module.exports = router;
|