film.js 522 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. var User = require('../models/User');
  3. var Watch = require('../models/Watch');
  4. var mongoose = require('mongoose');
  5. const bodyParser = require('body-parser');
  6. /**
  7. * Get the Film info page
  8. */
  9. exports.filmGet = function(req, res){
  10. var options = {
  11. film: []
  12. }
  13. Watch.findOne({ 'permalink': req.params.permalink }, function(err, film){
  14. if (!film) {
  15. return res.redirect('/404');
  16. }
  17. if (film) {
  18. options.film = film
  19. res.render('film', options);
  20. }
  21. }).populate('criador');
  22. };