Skip to content

Instantly share code, notes, and snippets.

View RamadhanAmizudin's full-sized avatar
:electron:

Ramadhan Amizudin RamadhanAmizudin

:electron:
View GitHub Profile
@RamadhanAmizudin
RamadhanAmizudin / gist:8912160
Created February 10, 2014 08:15
Node.JS / Request
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