Page Contents

Home > @loopback/rest > RestServer > sequence

RestServer.sequence() method

Configure a custom sequence class for handling incoming requests.

Signature:

sequence(sequenceClass: Constructor<SequenceHandler>): Binding<SequenceHandler>;

Parameters

Parameter Type Description
sequenceClass Constructor<SequenceHandler> The sequence class to invoke for each incoming request.

Returns:

Binding<SequenceHandler>

Example

class MySequence implements SequenceHandler {
  constructor(
    @inject('send) public send: Send)) {
  }

  public async handle({response}: RequestContext) {
    send(response, 'hello world');
  }
}