const {authJwt} = require("../middlewares");
module.exports = app => {
	const breakfast = require("../controllers/breakfast.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 breakfasts
	router.get("/", [authJwt.verifyToken], breakfast.getAllBreakfasts);
	// Create a new breakfast
	router.post("/", [authJwt.verifyToken], breakfast.createNewBreakfast);
	router.put('/:id', [authJwt.verifyToken], breakfast.updateBreakfast);
	router.delete('/:id', [authJwt.verifyToken], breakfast.deleteBreakfast)
	app.use('/api/breakfasts', router);
};