@drizzle-http/rxjs-adapter
v3.1.0
Published
RxJs call adapter for Drizzle-HTTP
Downloads
13
Maintainers
Readme
RxJs Call Adapter ·
RxJs call adapter implementation for Drizzle-HTTP.
Installation
Make sure we have the core module @Drizzle-Http/core installed.
npm i @drizzle-http/core
npm i @drizzle-http/rxjs-adapter
Usage
After adding the RxJsCallAdapterFactory
to Drizzle instance, decorate your class or methods with @RxJs()
.
See the example below.
import { GET } from "@drizzle-http/core";
import { Param } from "@drizzle-http/core";
import { RxJs } from "@drizzle-http/rxjs-adapter";
import { DrizzleBuilder } from "@drizzle-http/core";
import { RxJsCallAdapterFactory } from "@drizzle-http/rxjs-adapter";
@RxJs()
class API {
@GET('/{id}/projects')
projects(@Param('id') id: string): Observable<Project[]> { }
}
const api = DrizzleBuilder
.newBuilder()
.baseUrl(addr)
.addCallAdapterFactories(new RxJsCallAdapterFactory(/* optional: you can pass another adapter factory */))
.build()
.create(API)