nestjs-http-promise
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "nestjs-http-promise", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "nestjs", |
# nestjs-http-promise | ||
[![npm version](https://img.shields.io/npm/v/nestjs-http-promise.svg?style=flat-square)](https://www.npmjs.org/package/nestjs-http-promise) | ||
@@ -9,7 +10,9 @@ ## description | ||
* axios - the most used package for http requests in npm. | ||
* promise based - most of us using the current http module and on every call do `.toPromise()` | ||
because most of the time we do not need the features of observable. | ||
* retries - one of the powerful features of observable is its ability to do in very simple way, | ||
you can do it by just adding the retry operator, this package will provide you the same feature even in easier way, | ||
just pass `{ retries: NUMBER_OF_RETRIES }` in the config of the http module. | ||
* 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. | ||
* retries - in many cases we will want to retry a failing http call. | ||
with observable we could just add the retry operator (rxjs) but with promises we need to implement this logic ourselves. | ||
this package will make it easy for you, just pass `{ retries: NUMBER_OF_RETRIES }` in the config of the http module. | ||
**more details in the configuration section** | ||
## quick start | ||
@@ -53,3 +56,3 @@ ### installing | ||
##configuration | ||
## configuration | ||
@@ -104,3 +107,3 @@ the service uses axios and axios-retry, so you can pass any [AxiosRequestConfig](https://github.com/axios/axios#request-config) | ||
async createHttpOptions(): Promise<HttpModuleOptions> { | ||
const configurationData = await sonmeAsyncMethod(); | ||
const configurationData = await someAsyncMethod(); | ||
return { | ||
@@ -121,2 +124,2 @@ timeout: configurationData.timeout, | ||
}); | ||
``` | ||
``` |
Sorry, the diff of this file is not supported yet
26999
122
28