我开始使用包"ua-parser"但是创建者太忙而无法保密或提交... npm ua-parser已经过时,需要直接从github下载.有人知道像ua-parser这样的其他优秀软件包已经更新并可以与expressjs一起使用吗?或者有办法处理expressjs?
我使用node.js与Jade模板系统.
假设,我有这些路由规则:
// ./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'
});
};
Run Code Online (Sandbox Code Playgroud)
这些虚拟视图:
// ./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
Run Code Online (Sandbox Code Playgroud)
author对于两个视图,我如何一般声明变量?