---
lang: en
title: 'API docs: rest.defaultsequence'
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.defaultsequence.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/rest](./rest.md) &gt; [DefaultSequence](./rest.defaultsequence.md)

## DefaultSequence class

The default implementation of SequenceHandler.

**Signature:**

```typescript
export declare class DefaultSequence implements SequenceHandler 
```
**Implements:** [SequenceHandler](./rest.sequencehandler.md)

## Remarks

This class implements default Sequence for the LoopBack framework. Default sequence is used if user hasn't defined their own Sequence for their application.

Sequence constructor() and run() methods are invoked from \[\[http-handler\]\] when the API request comes in. User defines APIs in their Application Controller class.

## Example

User can bind their own Sequence to app as shown below

```ts
app.bind(CoreBindings.SEQUENCE).toClass(MySequence);
```

## Constructors

<table><thead><tr><th>

Constructor


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[(constructor)(findRoute, parseParams, invoke, send, reject)](./rest.defaultsequence._constructor_.md)


</td><td>


</td><td>

Constructor: Injects findRoute, invokeMethod &amp; logError methods as promises.


</td></tr>
</tbody></table>

## Properties

<table><thead><tr><th>

Property


</th><th>

Modifiers


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[findRoute](./rest.defaultsequence.findroute.md)


</td><td>

`protected`


</td><td>

[FindRoute](./rest.findroute.md)


</td><td>


</td></tr>
<tr><td>

[invoke](./rest.defaultsequence.invoke.md)


</td><td>

`protected`


</td><td>

[InvokeMethod](./rest.invokemethod.md)


</td><td>


</td></tr>
<tr><td>

[invokeMiddleware](./rest.defaultsequence.invokemiddleware.md)


</td><td>

`protected`


</td><td>

InvokeMiddleware


</td><td>

Optional invoker for registered middleware in a chain. To be injected via SequenceActions.INVOKE\_MIDDLEWARE.


</td></tr>
<tr><td>

[parseParams](./rest.defaultsequence.parseparams.md)


</td><td>

`protected`


</td><td>

[ParseParams](./rest.parseparams.md)


</td><td>


</td></tr>
<tr><td>

[reject](./rest.defaultsequence.reject.md)


</td><td>


</td><td>

[Reject](./rest.reject.md)


</td><td>


</td></tr>
<tr><td>

[send](./rest.defaultsequence.send.md)


</td><td>


</td><td>

[Send](./rest.send.md)


</td><td>


</td></tr>
</tbody></table>

## Methods

<table><thead><tr><th>

Method


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[handle(context)](./rest.defaultsequence.handle.md)


</td><td>


</td><td>

Runs the default sequence. Given a handler context (request and response), running the sequence will produce a response or an error.

Default sequence executes these steps - Executes middleware for CORS, OpenAPI spec endpoints - Finds the appropriate controller method, swagger spec and args for invocation - Parses HTTP request to get API argument list - Invokes the API which is defined in the Application Controller - Writes the result from API into the HTTP response - Error is caught and logged using 'logError' if any of the above steps in the sequence fails with an error.


</td></tr>
</tbody></table>

