@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
67 lines (35 loc) • 1.69 kB
Markdown
---
lang: en
title: 'API docs: rest.defaultsequence.handle'
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.handle.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/rest](./rest.md) > [DefaultSequence](./rest.defaultsequence.md) > [handle](./rest.defaultsequence.handle.md)
## DefaultSequence.handle() method
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.
**Signature:**
```typescript
handle(context: RequestContext): Promise<void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
context
</td><td markdown="1">
[RequestContext](./rest.requestcontext.md)
</td><td markdown="1">
The request context: HTTP request and response objects, per-request IoC container and more.
</td></tr>
</tbody></table>
**Returns:**
Promise<void>