2021-05-23 17:18:04 +02:00
|
|
|
const express = require('express');
|
|
|
|
const router = express.Router();
|
2021-11-11 16:43:00 +01:00
|
|
|
|
|
|
|
// middleware
|
|
|
|
const { upload, auth, requireAuth } = require('../middleware');
|
2021-05-23 17:18:04 +02:00
|
|
|
|
|
|
|
const {
|
|
|
|
createBookmark,
|
2021-10-22 14:00:38 +02:00
|
|
|
getAllBookmarks,
|
|
|
|
getSingleBookmark,
|
2021-05-23 17:18:04 +02:00
|
|
|
updateBookmark,
|
2021-10-22 14:00:38 +02:00
|
|
|
deleteBookmark,
|
2021-11-22 16:45:59 +01:00
|
|
|
reorderBookmarks,
|
2021-10-22 14:00:38 +02:00
|
|
|
} = require('../controllers/bookmarks');
|
2021-05-23 17:18:04 +02:00
|
|
|
|
2021-11-11 16:43:00 +01:00
|
|
|
router
|
|
|
|
.route('/')
|
|
|
|
.post(auth, requireAuth, upload, createBookmark)
|
|
|
|
.get(auth, getAllBookmarks);
|
2021-05-23 17:18:04 +02:00
|
|
|
|
|
|
|
router
|
|
|
|
.route('/:id')
|
2021-11-11 16:43:00 +01:00
|
|
|
.get(auth, getSingleBookmark)
|
|
|
|
.put(auth, requireAuth, upload, updateBookmark)
|
|
|
|
.delete(auth, requireAuth, deleteBookmark);
|
2021-05-23 17:18:04 +02:00
|
|
|
|
2021-11-22 16:45:59 +01:00
|
|
|
router.route('/0/reorder').put(auth, requireAuth, reorderBookmarks);
|
|
|
|
|
2021-10-22 14:00:38 +02:00
|
|
|
module.exports = router;
|