This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
SA3/hw7/Claudio_Maggioni/routes/bookmarked/router.js

25 lines
509 B
JavaScript
Raw Normal View History

2019-11-11 15:58:06 +00:00
/** @module root/router */
'use strict';
// vim: set ts=2 sw=2 et tw=80:
const express = require('express');
const router = express.Router();
const mongoose = require('mongoose');
const Favorite = mongoose.model('Favorite');
const { error, renderFav } = require('../utils');
router.get('/', (req, res) => {
Favorite.find({ bookmarked: true }, (err, favs) => {
if (err) {
return error(err, res);
}
renderFav(req, res, favs);
});
});
/** router for /root */
module.exports = router;