Created
February 10, 2014 08:15
-
-
Save RamadhanAmizudin/8912160 to your computer and use it in GitHub Desktop.
Node.JS / Request
This file contains 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
var request = require('request'); | |
var hosts = ["http://host1/", "http://host2/", "http://host3/"]; | |
hosts.forEach(function(val) { | |
request.get(val + 'status', function(error, response, body) { | |
var r = JSON.parse(body); | |
var status = r.status; | |
}); | |
}); | |
// How can I do if status == 'idle' and immedietly break the loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment