123456789101112131415161718192021222324 |
- 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)
- .post('/auth/login', validation.logIn, controllers.logIn)
- .post('/auth/logout', guard, controllers.logOut)
- .post('/auth/online', guard, controllers.online)
- .patch(
- '/users/current',
- [guard, validation.updateUser],
- controllers.updateCredentials
- )
- .get('/users/current', guard, controllers.getCurrent)
- .patch(
- '/users/avatars',
- [guard, upload.single('avatar'), validation.validateUploadFile],
- controllers.updateAvatar
- );
- module.exports = router;
|