I want to run a code after my async forEach loop.
myPosts.forEach(function(post) {
getPostAuthor(post.authorID, function(postAuthor) {
post.author = postAuthor;
}
});
res.render('index', {
posts: myPosts
});
res.end();
in code above first res.render runs and after that forEach fills the post.author