1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-29 07:39:36 +02:00
flame/routes/bookmark.js

35 lines
800 B
JavaScript
Raw Normal View History

2021-05-23 17:18:04 +02:00
const express = require('express');
const router = express.Router();
// middleware
const { upload, auth, requireAuth } = require('../middleware');
2021-05-23 17:18:04 +02:00
const {
createBookmark,
getAllBookmarks,
getSingleBookmark,
2021-05-23 17:18:04 +02:00
updateBookmark,
deleteBookmark,
reorderBookmarks,
2022-02-06 08:21:01 -05:00
importBookmark,
} = require('../controllers/bookmarks');
2021-05-23 17:18:04 +02:00
router
.route('/')
2022-02-06 08:21:01 -05:00
.post(auth, requireAuth, upload.icon, createBookmark)
.get(auth, getAllBookmarks);
2021-05-23 17:18:04 +02:00
router
.route('/:id')
.get(auth, getSingleBookmark)
2022-02-06 08:21:01 -05:00
.put(auth, requireAuth, upload.icon, updateBookmark)
.delete(auth, requireAuth, deleteBookmark);
2021-05-23 17:18:04 +02:00
2022-02-06 08:21:01 -05:00
router
.route('/import')
.post(auth, requireAuth, upload.bookmark, importBookmark, getAllBookmarks)
router.route('/0/reorder').put(auth, requireAuth, reorderBookmarks);
module.exports = router;