voyager.retry-strategy
v0.1.9
Published
A library for retrying failed HTTP requests in Angular applications.
Downloads
11
Readme
VoyagerRetryStrategy
Guide
This project provides a service used for configuring angular connections with option for retrying upon a certain delay or based of returning status codes.
Installation - Authorization
To install the NPM package, first you need to add a .npmrc file in angular application solution dictionary, at the same level as package.json is present.
With the fallowing configuration:
@voyager-poland:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${NPM_ACCESS_TOKEN}Where NPM_ACCESS_TOKEN refers to environment variable containing github access token.
Installation - adding NPM package
To add the NPM package into your project simply run the command:
npm install @voyager-poland/voyager.retry-strategy
To install the newest version or use:
npm install @voyager-poland/[email protected]
Where 0.0.1 is the version of the nuget, to install any version.
Usage
Importing the correct service:
import { retryStrategy } from "@voyager-poland/voyager.retry-strategy/projects/retry-strategy/src/lib/services/retry-strategy";
To any MonoTypeOperatorFunction like for example HttpClient's Post, you can simply use .pipe() and use the retryStrategy() in there:
By default it is created with thoes variables:
maxRetries = 3,
delayMs = 1000,
retryableStatusCodes = [0, 500, 503]But thoes can be modified at any point, for custom requirements:
