const {authJwt} = require("../middlewares");
module.exports = app => {
	const label = require("../controllers/label.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 labels
	router.get("/", [authJwt.verifyToken], label.getAllLabels);
	// Create a new label
	router.post("/", [authJwt.verifyToken], label.createNewLabel);
	router.put('/:id', [authJwt.verifyToken], label.updateLabel);
	router.delete('/:id', [authJwt.verifyToken], label.deleteLabel)
	app.use('/api/labels', router);
};