home.js 412 B

1234567891011121314151617181920212223
  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. };