NestJS tip: how to inject multiple versions of the same provider into one module (e.g.: many Axios instances)

This page summarizes the projects mentioned and recommended in the original post on dev.to

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • http.cat

    :cat: HTTP Cats API

  • import { Module, OnModuleInit } from '@nestjs/common' import { HttpModule, HttpService } from '@nestjs/axios' import { CatApi } from './cat-api.service' @Module({ imports: [ HttpModule.register({ // line A timeout: 1_000, maxRedirects: 2, baseURL: 'https://http.cat', }), ], providers: [ { provide: CatApi, useExisting: HttpService, // line B } ], exports: [CatApi], // line C }) export class CatApiModule implements OnModuleInit { constructor(private readonly httpService: HttpService) {} onModuleInit() { this.httpService.axiosRef.defaults.headers.common['Accept'] = 'application/json' } }

  • axios

    Axios module for Nest framework (node.js) 🗂 (by nestjs)

  • For example, when using the HttpModule module from @nestjs/axios we can use the dynamic module HttpModule.register() to configure our Axios instance. That module exposes a HttpService that has such configuration. But what if we want to have many Axios instances, each one with its own config and import everything in one module?

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Ask HN: Happy 404 Day. Whats your favorite 404 error page?

    2 projects | news.ycombinator.com | 4 Apr 2024
  • HTTP Area Codes

    1 project | news.ycombinator.com | 31 Jan 2024
  • Lidando com exceções: como fazer erros práticos e elegantes no Express js

    1 project | dev.to | 15 Jan 2024
  • HTTP Cats

    1 project | news.ycombinator.com | 2 Oct 2023
  • What I've learnt in 1 month of programming

    1 project | dev.to | 27 Sep 2023