UNPKG

@loopback/docs

Version:
44 lines (27 loc) 932 B
--- lang: en title: 'API docs: rest.restserver.handler' keywords: LoopBack 4.0, LoopBack 4 sidebar: lb4_sidebar permalink: /doc/en/lb4/apidocs.rest.restserver.handler.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/rest](./rest.md) &gt; [RestServer](./rest.restserver.md) &gt; [handler](./rest.restserver.handler.md) ## RestServer.handler() method Configure a custom sequence function for handling incoming requests. <b>Signature:</b> ```typescript handler(handlerFn: SequenceFunction): void; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | handlerFn | <code>SequenceFunction</code> | The handler to invoke for each incoming request. | <b>Returns:</b> `void` ## Example ```ts app.handler(({request, response}, sequence) => { sequence.send(response, 'hello world'); }); ```