Created
July 21, 2011 17:48
-
-
Save jcleveley-zz/1097744 to your computer and use it in GitHub Desktop.
Are these parallel requests?
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 factory = function(info) { | |
return function (error, response, body) { | |
if(response && response.statusCode === 200){ | |
var obj = JSON.parse(body); | |
console.log(info.id, obj.likes); | |
} else { | |
console.log('error: '+ error); | |
} | |
} | |
}; | |
for (var i = 0; i<100; i++){ | |
request.get({ | |
uri: 'http://graph.facebook.com/18311355911', | |
}, factory({id: i}) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment