docs: update README
Update README commit-id:9330f485
This commit is contained in:
parent
969d3b8c15
commit
d593f1170e
1 changed files with 10 additions and 13 deletions
|
@ -8,8 +8,6 @@ nestjs module that just doing little modification to the original and good **nes
|
||||||
|
|
||||||
## features
|
## features
|
||||||
* axios - the most used package for http requests in npm and the one used by nestjs official http library.
|
* axios - the most used package for http requests in npm and the one used by nestjs official http library.
|
||||||
* better axios stack trace - axios has an [open issue](https://github.com/axios/axios/issues/2387) about improvement of their stack trace.
|
|
||||||
in this library there is a default interceptor that will intercept the stack trace and will add data to it.
|
|
||||||
* promise based - most of us using the current http module that uses observable which we don't use most of the time
|
* promise based - most of us using the current http module that uses observable which we don't use most of the time
|
||||||
and in order to avoid it were just calling `.toPromise()` every http call.
|
and in order to avoid it were just calling `.toPromise()` every http call.
|
||||||
* retries - in many cases we will want to retry a failing http call.
|
* retries - in many cases we will want to retry a failing http call.
|
||||||
|
@ -68,7 +66,7 @@ import { HttpModule } from 'nestjs-http-promise'
|
||||||
imports: [HttpModule.register(
|
imports: [HttpModule.register(
|
||||||
{
|
{
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
retries: 5,
|
retries: 10,
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
)]
|
)]
|
||||||
|
@ -77,7 +75,6 @@ import { HttpModule } from 'nestjs-http-promise'
|
||||||
|
|
||||||
### default configuration
|
### default configuration
|
||||||
* default config of axios-retry : https://github.com/softonic/axios-retry#options
|
* default config of axios-retry : https://github.com/softonic/axios-retry#options
|
||||||
* better axios stack trace is added by default, you can turn it off by passing the **isBetterStackTraceEnabled** to false.
|
|
||||||
|
|
||||||
## async configuration
|
## async configuration
|
||||||
When you need to pass module options asynchronously instead of statically, use the `registerAsync()` method **just like in nest httpModule**.
|
When you need to pass module options asynchronously instead of statically, use the `registerAsync()` method **just like in nest httpModule**.
|
||||||
|
@ -88,7 +85,7 @@ you have a couple of techniques to do it:
|
||||||
HttpModule.registerAsync({
|
HttpModule.registerAsync({
|
||||||
useFactory: () => ({
|
useFactory: () => ({
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
retries: 5,
|
retries: 10,
|
||||||
...
|
...
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
@ -109,7 +106,7 @@ class HttpConfigService implements HttpModuleOptionsFactory {
|
||||||
const configurationData = await someAsyncMethod();
|
const configurationData = await someAsyncMethod();
|
||||||
return {
|
return {
|
||||||
timeout: configurationData.timeout,
|
timeout: configurationData.timeout,
|
||||||
retries: 5,
|
retries: 10,
|
||||||
...
|
...
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue