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