【发布时间】:2013-06-12 19:42:20
【问题描述】:
如何在 response.render 中调用另一个快速路由。以下是我的代码 sn-p。我想在请求 /pages/performance 时渲染 performance.jade 并使用 /api/notifications 返回的数据填充翡翠
module.exports = function(app){
app.get('/pages/performance', function(req, res){
res.render("performance", {results: app.get("/api/notifications", function (request, response) {return response.body;}), title: "Performance"});
});
};
/api/notifications 将返回json数据,然后在jade中使用如下:
block pageContent
for result in results
p #{result.message}
【问题讨论】: