This is my first nodejs application. I am trying to do a cronjob with fetching some external API and do some calculation of the response.
Everything works fine until the curlList is to big. With 10 items in curlList it's okey, but I have a big big curlList more than 90 items.
What is the best way to do this implementation.
Thanks for helping.
Best regards, Johnny
var request = require('request');
var curlList = [{
id: 1,
href: '/name1'
}, {
id: 2,
href: '/name2'
}, {
id: 3,
href: '/name3'
}];
var curl = function(id, url) {
var payload = {
id: id
};
var options = {
method: 'post',
body: payload,
json: true,
url: ""
}
request(options, function(err, res, body) {
if (err) {
console.log(err, 'error posting json')
return
}
//Calculate response data
//If match
if (match) {
console.log(url);
}
});
};
app.listen(3000, function() {
for (var i = 0; i < curlList.length; i++) {
var href = list[i].href;
var id = list[i].id;
curl(id, href);
}
});