change readme and removed unused file
This commit is contained in:
parent
189df64fda
commit
bd42e029ef
3 changed files with 10 additions and 9 deletions
|
@ -1,2 +1 @@
|
||||||
.eslintrc.js
|
.eslintrc.js
|
||||||
index.ts
|
|
15
README.md
15
README.md
|
@ -1,4 +1,5 @@
|
||||||
# nestjs-http-promise
|
# 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)
|
||||||
|
|
||||||
## description
|
## description
|
||||||
nestjs module that just doing little modification to the original and good **nestjs** http module.
|
nestjs module that just doing little modification to the original and good **nestjs** http module.
|
||||||
|
@ -6,11 +7,13 @@ 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.
|
* 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()`
|
* promise based - most of us using the current http module that uses observable which we don't use most of the time
|
||||||
because most of the time we do not need the features of observable.
|
and in order to avoid it were just calling `.toPromise()` every http call.
|
||||||
* retries - one of the powerful features of observable is its ability to do in very simple way,
|
* retries - in many cases we will want to retry a failing http call.
|
||||||
you can do it by just adding the retry operator, this package will provide you the same feature even in easier way,
|
with observable we could just add the retry operator (rxjs) but with promises we need to implement this logic ourselves.
|
||||||
just pass `{ retries: NUMBER_OF_RETRIES }` in the config of the http module.
|
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
|
## quick start
|
||||||
### installing
|
### installing
|
||||||
Using npm:
|
Using npm:
|
||||||
|
@ -99,7 +102,7 @@ Note that in this example, the HttpConfigService has to implement HttpModuleOpti
|
||||||
@Injectable()
|
@Injectable()
|
||||||
class HttpConfigService implements HttpModuleOptionsFactory {
|
class HttpConfigService implements HttpModuleOptionsFactory {
|
||||||
async createHttpOptions(): Promise<HttpModuleOptions> {
|
async createHttpOptions(): Promise<HttpModuleOptions> {
|
||||||
const configurationData = await sonmeAsyncMethod();
|
const configurationData = await someAsyncMethod();
|
||||||
return {
|
return {
|
||||||
timeout: configurationData.timeout,
|
timeout: configurationData.timeout,
|
||||||
retries: 5,
|
retries: 5,
|
||||||
|
|
1
index.ts
1
index.ts
|
@ -1 +0,0 @@
|
||||||
export * from './lib'
|
|
Loading…
Reference in a new issue