Spaces:
Sleeping
Sleeping
const express = require('express'); | |
const router = express.Router(); | |
const { | |
getCategories, | |
getCategoryById, | |
createCategory, | |
updateCategory, | |
deleteCategory, | |
} = require('../controllers/categoryController'); | |
const { protect } = require('../middleware/auth'); | |
router.route('/') | |
.get(protect, getCategories) | |
.post(protect, createCategory); | |
router.route('/:id') | |
.get(protect, getCategoryById) | |
.put(protect, updateCategory) | |
.delete(protect, deleteCategory); | |
module.exports = router; |