-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtourRoutes.js
27 lines (24 loc) · 882 Bytes
/
tourRoutes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const express = require('express');
const tourController = require('../controller/tourController');
const authenticationController = require('../controller/authenticationController');
const router = express.Router();
// router.param('id', tourController.checkId);
router
.route('/top-5-cheap')
.get(tourController.getAliasTours, tourController.getAllTours);
router.route('/get-tour-stat').get(tourController.getTourStats);
router.route('/yearly-plan/:year').get(tourController.getYearlyPlan);
router
.route('/')
.get(authenticationController.sendProtect, tourController.getAllTours)
.post(tourController.createTour);
router
.route('/:id')
.get(tourController.getTour)
.patch(tourController.updateTour)
.delete(
authenticationController.sendProtect,
authenticationController.restrict('admin'),
tourController.deleteTour
);
module.exports = router;