home.js 422 B

123456789101112131415161718192021222324
  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. {
  10. Watch.find({}, null, {sort: '-year'}, function(err, watch){
  11. if(err){
  12. console.log(err);
  13. } else {
  14. res.render('inicio', {
  15. title: res.__('Início'),
  16. watch: watch
  17. });
  18. }
  19. });
  20. };