nestjs / axios

Axios module for Nest framework (node.js) 🗂

Home Page:https://docs.nestjs.com/techniques/http-module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I register the axios httpmodule module globally?

PanHywel opened this issue · comments

commented

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

How do I register the axios httpmodule module globally?

Describe the solution you'd like

@Module({
  imports: [
    HttpModule.register({
      timeout: 5000,
      maxRedirects: 5,
      httpsAgent: new Agent({
        rejectUnauthorized: false
      }),
      transformResponse: [
        function (data) {
          // Dols whatever you want to transform the data
          return _json.parse(data);
        }
      ]
    })
  ],
  providers: [RequestService],
  exports: [RedisService]
})
expor

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

Easy to call

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.