mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-21 12:29:36 +02:00
23 lines
602 B
JavaScript
23 lines
602 B
JavaScript
|
const asyncWrapper = require('../../middleware/asyncWrapper');
|
||
|
const ErrorResponse = require('../../utils/ErrorResponse');
|
||
|
const importBookmarkData = require('../../utils/importBookmark');
|
||
|
const Bookmark = require('../../models/Bookmark');
|
||
|
|
||
|
// @desc Import bookmarks from file.
|
||
|
// @route POST /api/bookmarks/import
|
||
|
// @access Public
|
||
|
const importBookmark = asyncWrapper(async (req, res, next) => {
|
||
|
importBookmarkData(req.file.path);
|
||
|
|
||
|
if(next){
|
||
|
next();
|
||
|
} else {
|
||
|
res.status(200).json({
|
||
|
success: true,
|
||
|
data: bookmark,
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
module.exports = importBookmark;
|