Created
July 14, 2017 21:04
-
-
Save sespinosa/af31126275bf105d5c0f2f42725ed894 to your computer and use it in GitHub Desktop.
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
var request = require('request'); | |
var URL = 'https://jsonplaceholder.typicode.com/posts/'; | |
var requestHandler = function(err, res, body) { | |
if(err) { | |
// aca controlas el error. | |
console.log('ERROR:' + err); | |
return; | |
} | |
// Aca es donde haces algo con el body. | |
console.log(body); | |
}; | |
for(var i = 1 ; i < 101 ; i++) { | |
request({ | |
url: URL+i | |
}, requestHandler); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment