Add auth to the endpoints

_Well at least I think, idk if it works, please help me, aaaaaahhh_
This commit is contained in:
Stone_Red
2022-05-04 15:16:36 +02:00
parent 2147a7ec7a
commit f409d42f1c
5 changed files with 16 additions and 11 deletions
+4 -3
View File
@@ -1,12 +1,13 @@
import express from "express";
import { getPizzas, addPizza, deletePizza, getPizza, updatePizza } from "../controller/pizzas.controller";
import { requireAuthentication } from "../middleware/auth.middle";
const router = express.Router();
router.get("/", getPizzas);
router.get("/:id", getPizza);
router.post("/", addPizza);
router.put("/:id", updatePizza);
router.delete("/:id", deletePizza);
router.post("/", requireAuthentication, addPizza);
router.put("/:id", requireAuthentication, updatePizza);
router.delete("/:id", requireAuthentication, deletePizza);
module.exports = router;