mirror of
https://github.com/kevin-DL/complete-node-bootcamp.git
synced 2026-01-21 23:25:06 +00:00
Initial commit 🚀
This commit is contained in:
24
4-natours/after-section-13/routes/bookingRoutes.js
Normal file
24
4-natours/after-section-13/routes/bookingRoutes.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const express = require('express');
|
||||
const bookingController = require('./../controllers/bookingController');
|
||||
const authController = require('./../controllers/authController');
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
router.use(authController.protect);
|
||||
|
||||
router.get('/checkout-session/:tourId', bookingController.getCheckoutSession);
|
||||
|
||||
router.use(authController.restrictTo('admin', 'lead-guide'));
|
||||
|
||||
router
|
||||
.route('/')
|
||||
.get(bookingController.getAllBookings)
|
||||
.post(bookingController.createBooking);
|
||||
|
||||
router
|
||||
.route('/:id')
|
||||
.get(bookingController.getBooking)
|
||||
.patch(bookingController.updateBooking)
|
||||
.delete(bookingController.deleteBooking);
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user