mirror of
https://github.com/pawelmalak/flame.git
synced 2026-02-28 09:23:12 +08:00
Changed config api. Split config controllers into separate files. Split bookmarks controllers into separate files
This commit is contained in:
19
controllers/bookmarks/getAllBookmarks.js
Normal file
19
controllers/bookmarks/getAllBookmarks.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const asyncWrapper = require('../../middleware/asyncWrapper');
|
||||
const Bookmark = require('../../models/Bookmark');
|
||||
const { Sequelize } = require('sequelize');
|
||||
|
||||
// @desc Get all bookmarks
|
||||
// @route GET /api/bookmarks
|
||||
// @access Public
|
||||
const getAllBookmarks = asyncWrapper(async (req, res, next) => {
|
||||
const bookmarks = await Bookmark.findAll({
|
||||
order: [[Sequelize.fn('lower', Sequelize.col('name')), 'ASC']],
|
||||
});
|
||||
|
||||
res.status(200).json({
|
||||
success: true,
|
||||
data: bookmarks,
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = getAllBookmarks;
|
||||
Reference in New Issue
Block a user