operator: use
Effect operator for composing middleware directly inside stream pipeline.
Since version 4.0 use operator is deprecated. You can easily compose middlewares directly to the Observable chain.

Importing

1
import { use } from '@marblejs/core';
Copied!

Type declaration

1
use :: <I, O>(MiddlewareLike<I, O>, <?>EffectContext) -> Observable<I>
Copied!

Parameters

parameter
definition
middleware
MiddlewareLike
ctx
<optional> EffectContext

Returns

Observable<I>

Example

1
import { use } from '@marblejs/core';
2
import { r } from '@marblejs/http';
3
4
const foo$ = r.pipe(
5
r.matchPath('/'),
6
r.matchType('GET'),
7
r.useEffet(req$ => req$.pipe(
8
// ...
9
use(authorize$),
10
// ...
11
)));
Copied!
Last modified 1mo ago