list.js 317 B

12345678910111213141516171819202122
  1. let Watch = require('../models/Watch');
  2. /**
  3. * GET /
  4. */
  5. exports.index = function(req, res) {
  6. Watch.find({}, null, {sort: '-year'}, function(err, watch){
  7. if(err){
  8. console.log(err);
  9. } else {
  10. res.render('list', {
  11. title:'Obras Pendentes',
  12. watch: watch
  13. });
  14. }
  15. });
  16. };