Package Exports
- @drizzle-http/rxjs-adapter
- @drizzle-http/rxjs-adapter/package.json
Readme
RxJs Call Adapter ·

RxJs call adapter implementation for Drizzle-HTTP.
Installation
The main package, Drizzle-Http, already contains this module.
If you are installing each package individually, make sure to install
first @Drizzle-Http/core with: npm i @drizzle-http/core
NPM
npm i @drizzle-http/rxjs-adapterYarn
yarn add @drizzle-http/rxjs-adapterUsage
class API {
@GET('/{id}/projects')
@RxJs()
getRx(@Path('id') id: string): Observable<TestResult<TestId>> {
return theTypes(Observable, TestResult)
}
}
const api = DrizzleBuilder.newBuilder()
.baseUrl(addr)
.addCallAdapterFactories(RxJsCallAdapterFactory.DEFAULT)
.build()
.create(API)There are 3 things you need to do in order to enable RxJs return type for you API calls:
- Add RxJsCallAdapterFactory to your Drizzle instance.
- Your method return type must be: Observable<V>. Import the Observable from RxJs.
- Add: return theTypes(Observable) in the method body. This way, Drizzle knows the return handledType during the
setup and can set the RxJsCallAdapter for the request.
If you don't want to use the theTypes(..) function, use the decorator @RxJs() on the method. It's the same.