|
1 | 1 | # nestjs-http-promise
|
| 2 | +[](https://www.npmjs.org/package/nestjs-http-promise) |
2 | 3 |
|
3 | 4 | ## description
|
4 | 5 | nestjs module that just doing little modification to the original and good **nestjs** http module.
|
5 | 6 |
|
6 | 7 |
|
7 | 8 | ## features
|
8 | 9 | * axios - the most used package for http requests in npm.
|
9 |
| - * promise based - most of us using the current http module and on every call do `.toPromise()` |
10 |
| - because most of the time we do not need the features of observable. |
11 |
| - * retries - one of the powerful features of observable is its ability to do in very simple way, |
12 |
| - you can do it by just adding the retry operator, this package will provide you the same feature even in easier way, |
13 |
| - just pass `{ retries: NUMBER_OF_RETRIES }` in the config of the http module. |
| 10 | + * promise based - most of us using the current http module that uses observable which we don't use most of the time |
| 11 | + and in order to avoid it were just calling `.toPromise()` every http call. |
| 12 | + * retries - in many cases we will want to retry a failing http call. |
| 13 | + with observable we could just add the retry operator (rxjs) but with promises we need to implement this logic ourselves. |
| 14 | + this package will make it easy for you, just pass `{ retries: NUMBER_OF_RETRIES }` in the config of the http module. |
| 15 | + **more details in the configuration section** |
| 16 | + |
14 | 17 | ## quick start
|
15 | 18 | ### installing
|
16 | 19 | Using npm:
|
@@ -99,7 +102,7 @@ Note that in this example, the HttpConfigService has to implement HttpModuleOpti
|
99 | 102 | @Injectable()
|
100 | 103 | class HttpConfigService implements HttpModuleOptionsFactory {
|
101 | 104 | async createHttpOptions(): Promise<HttpModuleOptions> {
|
102 |
| - const configurationData = await sonmeAsyncMethod(); |
| 105 | + const configurationData = await someAsyncMethod(); |
103 | 106 | return {
|
104 | 107 | timeout: configurationData.timeout,
|
105 | 108 | retries: 5,
|
|
0 commit comments