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