flame/routes/bookmark.js
2021-11-11 16:43:00 +01:00

26 lines
575 B
JavaScript

const express = require('express');
const router = express.Router();
// middleware
const { upload, auth, requireAuth } = require('../middleware');
const {
createBookmark,
getAllBookmarks,
getSingleBookmark,
updateBookmark,
deleteBookmark,
} = require('../controllers/bookmarks');
router
.route('/')
.post(auth, requireAuth, upload, createBookmark)
.get(auth, getAllBookmarks);
router
.route('/:id')
.get(auth, getSingleBookmark)
.put(auth, requireAuth, upload, updateBookmark)
.delete(auth, requireAuth, deleteBookmark);
module.exports = router;