我想渲染 node.js 中所有项目的故事数组。怎么做?
app.get('/stories', function(request, response) {
var projects_ids = [1,2];
project_ids.forEach(function(id) {
pivotal.getStories(id, function(err, project_stories) {
console.log("Stories: " + project_stories);
return JSON.stringify(project_stories);
});
});
response.send(array_of_stories);
});
在日志中我得到:
Stories: [object Object]
Stories: [object Object]