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

Importing

1
import { httpListener } from '@marblejs/http';
Copied!

Type declaration

1
httpListener :: HttpListenerConfig -> Reader<Context, HttpListener>
Copied!

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
1
import { httpListener } from '@marblejs/http';
2
import { bodyParser$ } from '@marblejs/middleware-body';
3
import { logger$ } from '@marblejs/middleware-logger';
4
import { api$ } from './api';
5
6
const middlewares = [
7
logger$(),
8
bodyParser$(),
9
];
10
11
const effects = [
12
api$,
13
];
14
15
export const listener = httpListener({ middlewares, effects });
Copied!
Last modified 1mo ago