Skip to content

Commit fc6c13c

Browse files
authored
Merge pull request #342 from furality/spr/main/9330f485
docs: update README
2 parents 969d3b8 + d593f11 commit fc6c13c

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ nestjs module that just doing little modification to the original and good **nes
88

99
## features
1010
* axios - the most used package for http requests in npm and the one used by nestjs official http library.
11-
* better axios stack trace - axios has an [open issue](https://github.com/axios/axios/issues/2387) about improvement of their stack trace.
12-
in this library there is a default interceptor that will intercept the stack trace and will add data to it.
13-
* promise based - most of us using the current http module that uses observable which we don't use most of the time
11+
* promise based - most of us using the current http module that uses observable which we don't use most of the time
1412
and in order to avoid it were just calling `.toPromise()` every http call.
1513
* retries - in many cases we will want to retry a failing http call.
1614
with observable we could just add the retry operator (rxjs) but with promises we need to implement this logic ourselves.
1715
this package will make it easy for you, just pass `{ retries: NUMBER_OF_RETRIES }` in the config of the http module.
1816
**more details in the configuration section**
19-
20-
## quick start
17+
18+
## quick start
2119
### installing
2220
Using npm:
2321
```
@@ -34,7 +32,7 @@ $ yarn add nestjs-http-promise
3432
```ts
3533
import { HttpModule } from 'nestjs-http-promise'
3634

37-
@Module({
35+
@Module({
3836
imports: [HttpModule]
3937
})
4038
```
@@ -51,7 +49,7 @@ class Demo {
5149
use the service:
5250
```ts
5351
public callSomeServer(): Promise<object> {
54-
return this.httpService.get('http://fakeService')
52+
return this.httpService.get('http://fakeService')
5553
}
5654
```
5755
@@ -68,7 +66,7 @@ import { HttpModule } from 'nestjs-http-promise'
6866
imports: [HttpModule.register(
6967
{
7068
timeout: 1000,
71-
retries: 5,
69+
retries: 10,
7270
...
7371
}
7472
)]
@@ -77,7 +75,6 @@ import { HttpModule } from 'nestjs-http-promise'
7775

7876
### default configuration
7977
* default config of axios-retry : https://github.com/softonic/axios-retry#options
80-
* better axios stack trace is added by default, you can turn it off by passing the **isBetterStackTraceEnabled** to false.
8178

8279
## async configuration
8380
When you need to pass module options asynchronously instead of statically, use the `registerAsync()` method **just like in nest httpModule**.
@@ -88,14 +85,14 @@ you have a couple of techniques to do it:
8885
HttpModule.registerAsync({
8986
useFactory: () => ({
9087
timeout: 1000,
91-
retries: 5,
88+
retries: 10,
9289
...
9390
}),
9491
});
9592
```
9693

9794
* using class
98-
95+
9996
```ts
10097
HttpModule.registerAsync({
10198
useClass: HttpConfigService,
@@ -109,13 +106,13 @@ class HttpConfigService implements HttpModuleOptionsFactory {
109106
const configurationData = await someAsyncMethod();
110107
return {
111108
timeout: configurationData.timeout,
112-
retries: 5,
109+
retries: 10,
113110
...
114111
};
115112
}
116113
}
117114
```
118-
If you want to reuse an existing options provider instead of creating a copy inside the HttpModule,
115+
If you want to reuse an existing options provider instead of creating a copy inside the HttpModule,
119116
use the useExisting syntax.
120117
```ts
121118
HttpModule.registerAsync({

0 commit comments

Comments
 (0)