apunteak/ariketa-03/routes/index.js

30 lines
559 B
JavaScript
Raw Normal View History

2022-01-29 20:56:40 +01:00
/* GET home orrialdea */
exports.index = function(req, res){
var username;
var logged;
if(req.cookies.username){
username = req.cookies.username;
logged = true;
//console.log(username);
}
res.render('index',{logged: logged, username: username});
};
/* GET orrialde desberdinak */
exports.partials = function (req, res) {
var name;
var num;
if(req.params.name.includes('_')){
name = req.params.name.split("_")[0];
num = req.params.name.split("_")[1];
}else{
name = req.params.name;
}
res.render('partials/' + name, {num: num});
};