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/root/router.js
2019-11-11 16:58:06 +01:00

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;