Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bamada/nestjs-http-retry

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bamada/nestjs-http-retry

A robust NestJS module providing configurable HTTP request retry strategies, including Exponential Backoff and Constant Interval, to enhance the resilience of your applications.

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

NestJS HTTP Retry Module Logo

A resilient NestJS module to handle HTTP requests with configurable retry strategies.

code style: prettier


Table of Contents


Description

This module integrates an HTTP retry functionality into the NestJS framework, providing configurable retry strategies like Exponential Backoff or Constant Interval retries.

Features

The NestJS HTTP Retry module supports these key features:

  • Easy-to-use configurable retry strategies
  • Exponential Backoff retries
  • Constant Interval retries
  • No-retry option

Installation

You can install the module using yarn or npm:

$ yarn add @bamada/nestjs-http-retry

OR

$ npm i @bamada/nestjs-http-retry

Configuration

To configure the retry strategies, pass the desired settings when registering the module:

import {
  HttpRetryStrategiesModule,
  RetryStrategyType,
} from '@bamada/nestjs-http-retry';

@Module({
  imports: [
    HttpRetryStrategiesModule.register({
      type: RetryStrategyType.Interval,
      maxAttempts: 3,
      intervalMs: 1000,
    }),
  ],
  // Other module properties
})
export class AppModule {}

Usage

Once configured, use the HttpRetryStrategiesService to make HTTP requests with the built-in retry strategies.

Examples

Below is a simple example of how to use the HTTP Retry Strategies service:

import { Injectable } from '@nestjs/common';
import { HttpRetryStrategiesService } from '@bamada/nestjs-http-retry';

@Injectable()
export class YourService {
  constructor(private readonly httpRetryService: HttpRetryStrategiesService) {}

  async getResource() {
    return this.httpRetryService.get('https://your.api/resource').toPromise();
  }
}

Contribute & Disclaimer

Feel free to contribute by submitting pull requests or opening issues. This module comes with no warranty; use it at your own risk.

License

Distributed under the MIT License. See LICENSE for more information.

Contributors ✨

madcam
madcam

⚠️ 💻 📖 🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

Keywords

FAQs

Package last updated on 06 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc