@nuskin/axios-util
axios-util
allows you to use Axios in the exact same way you would use Axios
by itself, with one exception. axios-util
builds the retry
and timeout
resiliency patterns into Axios for you.
The default timeout has been set to 10000ms
.
Retry has been implemented with the axios-retry module. All defaults of axios-retry
are used except for retryDelay. retryDelay
is set to axiosRetry.exponentialDelay
Installing
Usng npm:
npm add @nuskin/axios-util
Usng yarn:
yarn add @nuskin/axios-util
Example usage
const { axios } = require('@nuskin/axios-util')
Customizing retry
You can customize your retry logic by accessing axios-retry
.
const { axios, axiosRetry } = require('@nuskin/axios-util')
axiosRetry(axios, { retryDelay: (retryCount) => {
return retryCount * 1000;
}})
Other possibilities for axios-util
Resources
License
MIT