0

I have this simple script:

request ({
    method: 'GET',
    url: 'https://www.link1.org/'
    url: 'https://link2.net/'
}, function(err, response, body) {
//do stuff
}

It works fine with single url but how could i add another? I need it to get both urls.

2
  • 2
    Possible duplicate of nodejs multiple http requests in loop Commented Aug 30, 2017 at 17:45
  • You have to do it as multiple requests. If you're not worried about 'callback hell' you could nest one request in the other's callback, but the popular thing to do is to promisify your requests and use Promise.all. Commented Aug 30, 2017 at 17:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.