Sto usando node.js
con il sistema di modelli Jade
.Variabile globale per i modelli di giada in node.js
Assumere, ho queste regole di routing:
// ./routes/first.js
exports.first = function(req, res)
{
res.render('first', {
author: 'Edward',
title: 'First page'
});
};
// ./routes/second.js
exports.second = function(req, res)
{
res.render('second', {
author: 'Edward',
title: 'Second page'
});
};
E questi punti di vista fittizi:
// ./views/first.jade
html
head
title #{author} – #{title}
body
span First page content
// ./views/second.jade
html
head
title #{author} – #{title}
body
span Second page content
Come posso dichiarare author
variabile in genere, sia per i punti di vista?
duplicati di http://stackoverflow.com/questions/4718818/express-js-view-globals –