mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-24 13:39:35 +02:00
Backend: auth for bookmarks and categories
This commit is contained in:
parent
22471d64c7
commit
0d36c5cf94
6 changed files with 39 additions and 12 deletions
|
@ -1,6 +1,9 @@
|
|||
const express = require('express');
|
||||
const router = express.Router();
|
||||
|
||||
// middleware
|
||||
const { auth, requireAuth } = require('../middleware');
|
||||
|
||||
const {
|
||||
createCategory,
|
||||
getAllCategories,
|
||||
|
@ -10,14 +13,17 @@ const {
|
|||
reorderCategories,
|
||||
} = require('../controllers/categories');
|
||||
|
||||
router.route('/').post(createCategory).get(getAllCategories);
|
||||
router
|
||||
.route('/')
|
||||
.post(auth, requireAuth, createCategory)
|
||||
.get(auth, getAllCategories);
|
||||
|
||||
router
|
||||
.route('/:id')
|
||||
.get(getSingleCategory)
|
||||
.put(updateCategory)
|
||||
.delete(deleteCategory);
|
||||
.get(auth, getSingleCategory)
|
||||
.put(auth, requireAuth, updateCategory)
|
||||
.delete(auth, requireAuth, deleteCategory);
|
||||
|
||||
router.route('/0/reorder').put(reorderCategories);
|
||||
router.route('/0/reorder').put(auth, requireAuth, reorderCategories);
|
||||
|
||||
module.exports = router;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue