home.js 306 B

12345678910111213141516171819
  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('home', {
  11. title:'Início',
  12. watch: watch
  13. });
  14. }
  15. });
  16. };