Nodejs Mongoose rendering results in Swig template

I am using Express 3.x. This is the code in my controller:

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

And in my swig template:

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

Then the message message is not displayed.

Please help me!

+4
source share

Source: https://habr.com/ru/post/1479460/


All Articles