utilisation de request params id
This commit is contained in:
parent
23b0328132
commit
377c48a430
|
@ -1,30 +1,19 @@
|
|||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
function btoa(string){
|
||||
return new Buffer(string).toString('base64');
|
||||
}
|
||||
|
||||
function atob(string){
|
||||
return new Buffer(string, 'base64').toString('ascii');
|
||||
}
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/:id', function(req, res, next) {
|
||||
var config = require('../config');
|
||||
var db = config.init_db();
|
||||
var data = [];
|
||||
|
||||
var id = /*atob(*/req.params.id/*)*/;
|
||||
console.log(id);
|
||||
|
||||
//on fais toute les opération de base a la suite
|
||||
db.serialize(function() {
|
||||
|
||||
db.each("SELECT i.id as id, i.title as title, t.hints as hints, p.file as file, i.duration as second, t.size as size, i.year as year"
|
||||
+ " FROM media_items t, metadata_items i, media_parts p "
|
||||
+ " WHERE t.id=p.media_item_id AND t.metadata_item_id = i.id AND t.hints LIKE '%show=?%' "
|
||||
,id, function(err, row) {
|
||||
,req.params.id, function(err, row) {
|
||||
console.log(err);
|
||||
console.log(row);
|
||||
//découpage des hints
|
||||
|
@ -53,10 +42,14 @@ router.get('/:id', function(req, res, next) {
|
|||
},
|
||||
//aprés toute les opération de la base
|
||||
function() {
|
||||
res.render('channel', { title: 'Episode de :'+id,channel:{
|
||||
'name': 'Episode de :'+id,
|
||||
'type': 2
|
||||
},videos: data });
|
||||
res.render('channel',{
|
||||
title: 'Episode de '+req.params.id,
|
||||
channel: {
|
||||
'name': 'Episode de '+req.params.id,
|
||||
'type': 2
|
||||
},
|
||||
videos: data
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue