not-found.js 432 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const Watch = require('../models/Watch');
  3. /**
  4. * Resolve 404 with 2 last uploaded productions
  5. */
  6. module.exports = (req, res) => {
  7. Watch.find({'top': 'new-l'}, null, {sort: '-_id'}, function(err, watches){
  8. let options = {
  9. title: 'Ops, não encontramos o que você procura',
  10. watches: []
  11. }
  12. if (watches) {
  13. options.watches = watches
  14. }
  15. res.status(404).render('error/404', options);
  16. }).limit(4);
  17. };