r.pipe
HttpEffect route builder based on IxMonad
Importing
import { r } from '@marblejs/http';pipe
piper namespace function. Creates pipeable RouteEffect builder.
Type declaration
pipe :: ...Arity<IxBuilder, IxBuilder> -> RouteEffectr.pipe builder pays attention to the order of applied operators.
const example$ = r.pipe(
r.matchPath('/'),
r.matchType('GET'),
r.use(middleware_1$),
r.useEffect(req$ => req$.pipe(
// ...
)),
r.use(middleware_2$), // ❌ type error!
);
// or
const example$ = r.pipe(
r.matchType('GET'),
r.matchPath('/'), // ❌ type error!
r.use(middleware_1$),
r.use(middleware_2$),
r.useEffect(req$ => req$.pipe(
// ...
)),
);Correct order:
<optional> applyMetamatchPathmatchTypeuse[...]useEffectapplyMeta[...]
matchPath
matchPathr namespace function. Matches request path for connected HttpEffect.
Type declaration
Parameters
parameter
definition
path
string
matchType
matchTyper namespace function. Matches HTTP method type for connected HttpEffect.
Type declaration
Parameters
parameter
definition
path
HttpMethod
use
user namespace function. Registers HTTP middleware with connected HttpEffect.
Type declaration
Parameters
parameter
definition
middleware
HttpMiddlewareEffect
useEffect
useEffectr namespace function. Registers HttpEffect.
Type declaration
Parameters
parameter
definition
effect
HttpEffect
applyMeta
applyMetar namespace function. Applies metadata to connected HttpEffect.
Type declaration
Parameters
parameter
definition
meta
RouteMeta
RouteMeta attributes:
parameter
type
definition
name
<optional> string
route/effect name
overridable
<optional> boolean
if true, the route can be overrode by another route
Example
Last updated