LogoLogo
ChangelogGitHubTwitterGitter
v3.x
v3.x
  • Marble.js
  • Getting started
    • Installation
    • Quick setup
  • HTTP
    • Effects
    • Middlewares
    • Routing
    • Errors
    • Output
    • Context
    • Advanced
      • Logging
      • Validation
      • Server Events
      • Streaming
      • Continuous mode
  • Messaging
    • Core concepts
      • Events
      • Effects
    • Microservices
      • AMQP (RabbitMQ)
      • Redis Pub/Sub
    • CQRS
    • WebSockets
  • Testing
    • HTTP routes testing
  • Other
    • How does it glue together?
    • Migration guides
      • Migration from version 2.x
      • Migration from version 1.x
    • API reference
      • core
        • bindTo
        • bindEagerlyTo
        • createEvent
        • createServer
        • combineRoutes
        • createContextToken
        • EffectFactory
        • r.pipe
        • httpListener
        • operator: matchEvent
        • operator: use
        • operator: act
      • messaging
        • eventBus
        • messagingClient
        • createMicroservice
        • reply
      • websockets
        • webSocketListener
        • operator: broadcast
        • operator: mapToServer
      • middleware-multipart
      • middleware-cors
      • middleware-joi
      • middleware-jwt
        • Token signing
      • middleware-io
      • middleware-logger
      • middleware-body
    • Style Guide
    • FAQ
Powered by GitBook
On this page
  • Importing
  • matchPath
  • Type declaration
  • Parameters
  • Returns
  • matchType
  • Type declaration
  • Parameters
  • Returns
  • use
  • Type declaration
  • Parameters
  • Returns
  • Example
  1. Other
  2. API reference
  3. core

EffectFactory

Set of factory functions for building router Effect.

PreviouscreateContextTokenNextr.pipe

Last updated 5 years ago

Deprecation warning

With an introduction of Marble.js 3.0, old EffectFactory HTTP route builder is deprecated. Please use builder instead.

Importing

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

matchPath

EffectFactory namespace function. Matches request path for connected Effect.

Type declaration

matchPath :: string -> matchType

Parameters

parameter

definition

path

string

Returns

EffectFactory matchType function

matchType

EffectFactory namespace function. Matches HTTP method type for connected Effect.

Type declaration

matchType :: HttpMethod -> use

Parameters

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 -> RouteEffect

Parameters

parameter

definition

effect

HttpEffect function

Returns

Factorized RouteEffect object.

Example

import { EffectFactory } from '@marblejs/core';
import { mapTo } from 'rxjs/operators';

export const root$ = EffectFactory
  .matchPath('/')
  .matchType('GET')
  .use(req$ => req$.pipe(
    mapTo({ body: `Hello, world! 👻` })
  ));

r.pipe