ajout de la page de presentation

This commit is contained in:
Antoine WEBER
2015-09-15 18:34:50 +02:00
parent 04ae473f75
commit 9e9737902f
5 changed files with 66 additions and 17 deletions

View File

@@ -42,16 +42,6 @@ router.get('/:id/:filename', function (req, res, next) {
db.close();
})
module.exports = router;

29
routes/movie.js Normal file
View File

@@ -0,0 +1,29 @@
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/:id', function(req, res, next) {
var config = require('../config');
var db = config.init_db();
var data;
db.get("SELECT id,title,original_title,studio,rating,summary,duration,tags_genre,tags_star,year FROM metadata_items WHERE id = ?",req.params.id, function(err, row) {
row.tags_genre = row.tags_genre.split('|');
row.tags_star = row.tags_star.split('|');
row.rating = Math.round(row.rating,2);
data = row;
res.render('movie', { title: 'Détail vidéo',movie: data });
});
db.close();
});
module.exports = router;