2021-05-22 20:04:34 +03:00
|
|
|
const express = require('express');
|
|
|
|
const router = express.Router();
|
|
|
|
|
|
|
|
const {
|
|
|
|
createCategory,
|
2021-11-05 01:39:35 +03:00
|
|
|
getAllCategories,
|
|
|
|
getSingleCategory,
|
2021-05-22 20:04:34 +03:00
|
|
|
updateCategory,
|
2021-06-18 14:42:55 +03:00
|
|
|
deleteCategory,
|
2021-11-05 01:39:35 +03:00
|
|
|
reorderCategories,
|
|
|
|
} = require('../controllers/categories');
|
2021-05-22 20:04:34 +03:00
|
|
|
|
2021-11-05 01:39:35 +03:00
|
|
|
router.route('/').post(createCategory).get(getAllCategories);
|
2021-05-22 20:04:34 +03:00
|
|
|
|
|
|
|
router
|
|
|
|
.route('/:id')
|
2021-11-05 01:39:35 +03:00
|
|
|
.get(getSingleCategory)
|
2021-05-22 20:04:34 +03:00
|
|
|
.put(updateCategory)
|
|
|
|
.delete(deleteCategory);
|
|
|
|
|
2021-11-05 01:39:35 +03:00
|
|
|
router.route('/0/reorder').put(reorderCategories);
|
2021-06-18 14:42:55 +03:00
|
|
|
|
2021-11-05 01:39:35 +03:00
|
|
|
module.exports = router;
|