---
lang: en
title: 'API docs: rest.restserver.sequence'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/rest
permalink: /doc/en/lb4/apidocs.rest.restserver.sequence.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; [sequence](./rest.restserver.sequence.md)

## RestServer.sequence() method

Configure a custom sequence class for handling incoming requests.

<b>Signature:</b>

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

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  sequenceClass | [Constructor](./context.constructor.md)<!-- -->&lt;[SequenceHandler](./rest.sequencehandler.md)<!-- -->&gt; | The sequence class to invoke for each incoming request. |

<b>Returns:</b>

[Binding](./context.binding.md)<!-- -->&lt;[SequenceHandler](./rest.sequencehandler.md)<!-- -->&gt;

## Example


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

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


