You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
633 B
JavaScript
26 lines
633 B
JavaScript
import express from "express";
|
|
import {
|
|
createCategory,
|
|
updateCategory,
|
|
removeCategory,
|
|
listCategory,
|
|
readCategory
|
|
} from "../controllers/categoryController.js";
|
|
import { authenticate, authorizeAdmin } from "../middleware/authMiddleWare.js";
|
|
const router = express.Router();
|
|
|
|
router.route("/").post(authenticate, authorizeAdmin, createCategory);
|
|
router
|
|
.route("/:categoryId")
|
|
.put(authenticate, authorizeAdmin, updateCategory)
|
|
.delete(authenticate, authorizeAdmin, removeCategory)
|
|
|
|
router
|
|
.route("/categories")
|
|
.get(listCategory)
|
|
|
|
router
|
|
.route("/:id")
|
|
.get(readCategory)
|
|
export default router;
|