在Swig模板中渲染Nodejs Mongoose的结果

时间:2013-05-07 02:28:09

标签: node.js express mongoose swig

我正在使用Express 3.x. 这是我的控制器中的代码:

Post.find({}, function(error, docs) {
   res.render('posts/index', {
        title: 'List of Posts',
        posts: docs,
      })
});

在我的swig模板中:

{% for post in posts %}
 {{post.message}}
{% endfor %}

然后,没有帖子的消息呈现。

请帮助我!

0 个答案:

没有答案