flame/routes/bookmark.js

27 lines
575 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,
} = 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
module.exports = router;