description |
---|
Effect operator for composing middleware directly inside stream pipeline. |
{% hint style="info" %}
Since version 4.0 use
operator is deprecated. You can easily compose middlewares directly to the Observable chain.
{% endhint %}
import { use } from '@marblejs/core';
use :: <I, O>(MiddlewareLike<I, O>, <?>EffectContext) -> Observable<I>
parameter | definition |
---|---|
middleware | MiddlewareLike |
ctx | <optional> EffectContext |
Observable<I>
import { use } from '@marblejs/core';
import { r } from '@marblejs/http';
const foo$ = r.pipe(
r.matchPath('/'),
r.matchType('GET'),
r.useEffet(req$ => req$.pipe(
// ...
use(authorize$),
// ...
)));