Answer the question
In order to leave comments, you need to log in
How to re-GET request in Node JS if request returned an error?
Good afternoon, I use the request-promise package in the project, but I would like an example on one of the popular packages (axios or others).
How can you intelligently make repeated get requests to the same URL with a delay of 10 seconds if the request returned an error from the site?
Answer the question
In order to leave comments, you need to log in
function get() {
axios.get('/user')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
setTimeout(get, 10000)
})
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question