150
rated 0 times
[
155]
[
5]
/ answers: 1 / hits: 16144
/ 7 Years ago, sun, february 19, 2017, 12:00:00
Is there a better/more beautiful way to call multiple APIs after another (in serial) as in my example?
var request = require('request');
request('http://www.test.com/api1', function (error, response, body) {
if (!error && response.statusCode == 200) {
request('http://www.test.com/api1', function (error, response, body) {
if (!error && response.statusCode == 200) {
request('http://www.test.com/api1', function (error, response, body) {
if (!error && response.statusCode == 200) {
//And so on...
}
})
}
})
}
})
More From » node.js