const {authJwt} = require("../middlewares");
module.exports = app => {
    const clients = require("../controllers/client.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 client
    router.post("/",[authJwt.verifyToken], clients.createClient);
    router.get("/:id",[authJwt.verifyToken], clients.getClient);
    // Update Client
    router.put("/:id",[authJwt.verifyToken], clients.updateClient );
    // Get clients with name or email
    router.get("/search", [authJwt.verifyToken], clients.getClientsWithNameOrEmail);
    app.use('/api/clients', router);
 };