mirror of
https://github.com/kevin-DL/complete-node-bootcamp.git
synced 2026-01-19 06:05:22 +00:00
25 lines
669 B
JavaScript
25 lines
669 B
JavaScript
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;
|