const {authJwt} = require("../middlewares");
module.exports = app => {
    const carousels = require("../controllers/carousel.controller.js");
    app.use((req, res, next) => {
      res.header(
        "Access-Control-Allow-Headers",
        "x-access-token, Origin, Content-Type, Accept"
      );
      next();
    });
    var router = require("express").Router();
    
    // Retrieve all carousels
    router.get("/", [authJwt.verifyToken], carousels.getAllCarousels);
    
    // Create a new carousel
    router.post("/", [authJwt.verifyToken], carousels.createNewCarousel);
    
    // Get one carousel by id
    router.get('/:id', [authJwt.verifyToken], carousels.getCarousel);
    
    // Update a carousel
    router.put('/:id', [authJwt.verifyToken], carousels.updateCarousel);
    
    // Delete a carousel
    router.delete('/:id', [authJwt.verifyToken], carousels.deleteCarousel);
    
    app.use('/api/carousels', router);
 }; 