flame/routes/bookmark.js

30 lines
665 B
JavaScript
Raw Normal View History

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