Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 895 Bytes

operator-use.md

File metadata and controls

49 lines (35 loc) · 895 Bytes
description
Effect operator for composing middleware directly inside stream pipeline.

operator: use

{% hint style="info" %} Since version 4.0 use operator is deprecated. You can easily compose middlewares directly to the Observable chain. {% endhint %}

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