-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.js
21 lines (18 loc) · 1.13 KB
/
router.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const router = require('express').Router();
const authMiddleware = require('./middlewares/authUser');
const userController = require('./controllers/user.controller');
const itemsController = require('./controllers/items.controllers');
router.post('/register', userController.createUser);
router.post('/login', userController.login);
router.get('/profile', authMiddleware, userController.profile);
router.delete('/deleteUser', authMiddleware, userController.deleteUser);
router.put('/update/:id', authMiddleware, userController.updateUser);
router.get('/user/:id', authMiddleware, userController.getUserById);
router.post('/search', authMiddleware, itemsController.search);
router.get('/nutrition/:id', authMiddleware, itemsController.getNutrition);
router.post('/addItem', authMiddleware, itemsController.addItem);
router.get('/getItems/:id/:date', authMiddleware, itemsController.getItemsByUserAndDate);
router.delete('/deleteItem/:id', authMiddleware, itemsController.deleteItemById);
router.put('/updateItem', authMiddleware, itemsController.updateById);
router.get('/userdays/:id', authMiddleware, userController.getUserDays);
module.exports = router;