Sunday, 16 April 2017

How do I extract an object from a promise? [duplicate]

This question already has an answer here:

I'm trying get some information out of a nosql database and then read that information through my template engine (handlebars), But I have no idea how to do it

all i'm getting is this message: enter image description here

here's some of the code I wrote thinking it could work

let blogPosts = blog.find().where().exec(function(err, blogInfo){
    return blogInfo
});

router.get('/', function(req, res) {
    res.render("blog-home", {blogposts: blogPosts})
});

thanks.



via Brian

No comments:

Post a Comment