const {authJwt} = require("../middlewares");
module.exports = app => {
    const staffs = require("../controllers/staff.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();
    // Create a new staff
    router.post("/", staffs.createStaff);
    // Update an Staff
    router.put("/:id",[authJwt.verifyToken], staffs.updateStaff );
    // Get Staff by email or username
    router.get("/search", [authJwt.verifyToken], staffs.getStaffsWithNameOrEmail)
    app.use('/api/staffs', router);
 };