mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-21 09:11:29 +03:00
30 lines
646 B
JavaScript
30 lines
646 B
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
|
|
// middleware
|
|
const { auth, requireAuth } = require('../middleware');
|
|
|
|
const {
|
|
createCategory,
|
|
getAllCategories,
|
|
getSingleCategory,
|
|
updateCategory,
|
|
deleteCategory,
|
|
reorderCategories,
|
|
} = require('../controllers/categories');
|
|
|
|
router
|
|
.route('/')
|
|
.post(auth, requireAuth, createCategory)
|
|
.get(auth, getAllCategories);
|
|
|
|
router
|
|
.route('/:id')
|
|
.get(auth, getSingleCategory)
|
|
.put(auth, requireAuth, updateCategory)
|
|
.delete(auth, requireAuth, deleteCategory);
|
|
|
|
router.route('/0/reorder').put(auth, requireAuth, reorderCategories);
|
|
|
|
module.exports = router;
|