1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-08-04 18:35:17 +02:00

Backend: auth for bookmarks and categories

This commit is contained in:
Paweł Malak 2021-11-11 16:43:00 +01:00
parent 22471d64c7
commit 0d36c5cf94
6 changed files with 39 additions and 12 deletions

View file

@ -1,6 +1,8 @@
const express = require('express');
const router = express.Router();
const upload = require('../middleware/multer');
// middleware
const { upload, auth, requireAuth } = require('../middleware');
const {
createBookmark,
@ -10,12 +12,15 @@ const {
deleteBookmark,
} = require('../controllers/bookmarks');
router.route('/').post(upload, createBookmark).get(getAllBookmarks);
router
.route('/')
.post(auth, requireAuth, upload, createBookmark)
.get(auth, getAllBookmarks);
router
.route('/:id')
.get(getSingleBookmark)
.put(upload, updateBookmark)
.delete(deleteBookmark);
.get(auth, getSingleBookmark)
.put(auth, requireAuth, upload, updateBookmark)
.delete(auth, requireAuth, deleteBookmark);
module.exports = router;