/** @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;
