flame/routes/category.js

24 lines
478 B
JavaScript
Raw Normal View History

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