A
A
Alex2017-01-24 19:15:12
Node.js
Alex, 2017-01-24 19:15:12

What's the best way to check an array of links using Node.JS?

There is a very large array of links leading to different pages of the same site. It is necessary to check the response code for each link, while not overloading the server and not falling under its filter.
If the response code is not 200, throw a message to the console.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nwton, 2017-01-24
@Nwton

In order not to overload the server, do the check sequentially.
1) There is an array
2) Run the check function
3) The function gets the first element, sends a request
4) If the response is received (200/404 etc.), removes the first element of the array, displays the code to the console
5) After that, checks the number of remaining elements, if > 0, starts itself via setTimeout 1000, otherwise reports completion

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question