Created
March 28, 2019 04:10
-
-
Save deleteman/009ad07489ee0d7307ea959c660b5913 to your computer and use it in GitHub Desktop.
using async-loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const req = require("request") | |
let calls = [ | |
function (cb) { | |
req.get('http://www.google.com', cb) | |
}, | |
function (cb) { | |
req.get('http://www.yahoo.com', cb) | |
}, | |
function (cb) { | |
req.get('http://www.msdn.com', cb) | |
} | |
] | |
asyncLoop(calls, (err, results) => { | |
if(err) { | |
return console.log("There was a problem executing one of the calls: ", err) | |
} | |
console.log("There are ", results.length, "sets of results") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment