home.js 416 B

123456789101112131415161718192021222324252627
  1. let Watch = require('../models/Watch');
  2. /* Nunjucks custom filter */
  3. var nunjucks = require('nunjucks');
  4. var env = new nunjucks.Environment();
  5. /**
  6. * GET /
  7. */
  8. exports.index = function(req, res) {
  9. Watch.find({}, null, {sort: '-year'}, function(err, watch){
  10. if(err){
  11. console.log(err);
  12. } else {
  13. res.render('inicio', {
  14. title:'Início',
  15. watch: watch
  16. });
  17. }
  18. });
  19. };