httpListener

Starting point of every Marble.js application. It includes definitions of all middlewares and API effects.

Importing

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

Type declaration

httpListener :: HttpListenerConfig -> Reader<Context, HttpListener>

Parameters

parameter

definition

config

HttpListenerConfig

HttpListenerConfig

parameter

definition

effects

<optional> Array<RouteEffect | RouteEffectGroup>

middlewares

<optional> Array<HttpMiddlewareEffect>

error$

<optional> HttpErrorEffect

output$

<optional> HttpOutputEffect

Returns

Reader<Context, HttpListener>

Example

http.listener
import { httpListener } from '@marblejs/core';
import { bodyParser$ } from '@marblejs/middleware-body';
import { logger$ } from '@marblejs/middleware-logger';
import { api$ } from './api';
const middlewares = [
logger$(),
bodyParser$(),
];
const effects = [
api$,
];
export const listener = httpListener({ middlewares, effects });