Skip to content

Instantly share code, notes, and snippets.

@deleteman
Created March 28, 2019 04:10
Show Gist options
  • Save deleteman/009ad07489ee0d7307ea959c660b5913 to your computer and use it in GitHub Desktop.
Save deleteman/009ad07489ee0d7307ea959c660b5913 to your computer and use it in GitHub Desktop.
using async-loop
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