---
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.

**Signature:**

```typescript
sequence(sequenceClass: Constructor<SequenceHandler>): Binding<SequenceHandler>;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td markdown="1">

sequenceClass


</td><td markdown="1">

[Constructor](./context.constructor.md)<!-- -->&lt;[SequenceHandler](./rest.sequencehandler.md)<!-- -->&gt;


</td><td markdown="1">

The sequence class to invoke for each incoming request.


</td></tr>
</tbody></table>

**Returns:**

[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');
  }
}
```


