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

import { use } from '@marblejs/core';

Type declaration

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

Parameters

parameter

definition

middleware

MiddlewareLike

ctx

<optional> EffectContext

Returns

Observable<I>

Example

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$),
    // ...
  )));

Last updated