EffectFactory
Set of factory functions for building router Effect.
Importing
import { EffectFactory } from '@marblejs/core';+ matchPath
EffectFactory namespace function. Matches request path for connected Effect.
Type declaration
matchPath :: string -> matchTypeParameters
parameter
definition
path
string
Returns
EffectFactory matchType function
+ matchType
EffectFactory namespace function. Matches HTTP method type for connected Effect.
Type declaration
matchType :: HttpMethod -> useParameters
parameter
definition
type
HttpMethod = 'POST | 'PUT' | 'PATCH' | 'GET' | 'HEAD' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | '*'
Returns
EffectFactory use function
+ use
EffectFactory namespace function. Connects Effect with path and HTTP method type.
Type declaration
use :: HttpEffect -> RouteEffectParameters
parameter
definition
effect
HttpEffect function
Returns
Factorized RouteEffect object.
Example
import { EffectFactory } from '@marblejs/core';
export const root$ = EffectFactory
.matchPath('/')
.matchType('GET')
.use(req$ => req$.pipe(
mapTo({ body: `Hello, world! 👻` })
));Last updated