Page Contents

Home > @loopback/rest > RestServer > handler

RestServer.handler() method

Configure a custom sequence function for handling incoming requests.

Signature:

handler(handlerFn: SequenceFunction): void;

Parameters

Parameter Type Description
handlerFn SequenceFunction The handler to invoke for each incoming request.

Returns:

void

Example

app.handler(({request, response}, sequence) => {
  sequence.send(response, 'hello world');
});