Home Async parallel to pass data in object
Reply: 0

Async parallel to pass data in object

user726
1#
user726 Published in April 26, 2018, 1:45 pm

So I'm trying to pass data from two databases to my dashboard view after user gets logged in, however...

  1. Don't know if that's the right way of doing.
  2. Don't know how to access those two objects that are passed in results.

router.get("/dashboard", middleware.isLoggedIn, function (req, res) { async.parallel([ function (callback) { callback(null, User.findById(req.user)); }, function (callback) { callback(null, Instrument.find({})); } ], function (err, results) { res.send("all good" + results); console.log(results) }); });

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.300618 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO