Node.js 在Swig模板中呈现Nodejs Mongoose的结果
我用的是Express 3.x 这是我的控制器中的代码:Node.js 在Swig模板中呈现Nodejs Mongoose的结果,node.js,express,mongoose,swig,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 %} 然后,没有帖子的消息呈现 请帮帮我
Post.find({}, function(error, docs) {
res.render('posts/index', {
title: 'List of Posts',
posts: docs,
})
});
在我的swig模板中:
{% for post in posts %}
{{post.message}}
{% endfor %}
然后,没有帖子的消息呈现
请帮帮我 一,。确保你有职位;2.确保没有
错误
。