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/hw5/Claudio_Maggioni/routes/bookmarked/router.js
2019-10-21 22:17:21 +02:00

18 lines
472 B
JavaScript

/** @module root/router */
'use strict';
// vim: set ts=2 sw=2 et tw=80:
const express = require('express');
const router = express.Router();
router.get('/', (req, res) => {
const favs = req.app.locals.favourites
.filter(e => e.bookmarked === true || e.bookmarked === 'true');
res.format({
html: () => res.render('favourites.dust', { favs: favs, bookmarked: true }),
json: () => res.send(favs)
});
});
/** router for /root */
module.exports = router;