【发布时间】:2012-12-02 22:33:03
【问题描述】:
尝试为 express 3.0 应用编写一些辅助方法。这是一个问候用户的示例:
app.locals.greet = function(req,res) {
return "hey there " + req.user.name;
}
但是,req 和 res 在该函数中不可用。我将如何编写可以在我的玉模板中使用的助手?我做错了吗?
【问题讨论】:
-
writing helpers that I can use inside my jade templates是什么意思?
标签: javascript node.js express connect