Array and loops through but I want to be able to run all of them in parallel instead as I don\'t want to run one after another.
I basically want to store all endpoin
Bluebird supports multiple concurrent Promises.
See the reference at: https://github.com/petkaantonov/bluebird/blob/master/API.md#promisejoinpromisethenablevalue-promises-function-handler---promise
There are two ways to do it:
.all() - good for a dynamic number of promises
.join() - good for a fixed number of promises and as for Bluebird's documentation, it supplies a better performance than .all() method.
From bluebird's documentation:
var Promise = require("bluebird");
var join = Promise.join;
join(getPictures(), getComments(), getTweets(),
function(pictures, comments, tweets) {
console.log("in total: " + pictures.length + comments.length + tweets.length);
});