24 lines
489 B
JavaScript
24 lines
489 B
JavaScript
/** @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 } = require('../utils');
|
|
|
|
router.get('/', (req, res) => {
|
|
Favorite.find({}, (err, favs) => {
|
|
if (err) {
|
|
return error(err, res);
|
|
}
|
|
|
|
res.render('index.dust', { favs });
|
|
});
|
|
});
|
|
|
|
/** router for /root */
|
|
module.exports = router;
|