UNPKG

@loopback/docs

Version:
61 lines (39 loc) 2.49 kB
--- lang: en title: 'API docs: rest.defaultsequence' keywords: LoopBack 4.0, LoopBack 4 sidebar: lb4_sidebar 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. <b>Signature:</b> ```typescript export declare class DefaultSequence implements SequenceHandler ``` ## Constructors | Constructor | Modifiers | Description | | --- | --- | --- | | [(constructor)(findRoute, parseParams, invoke, send, reject)](./rest.defaultsequence._constructor_.md) | | Constructor: Injects findRoute, invokeMethod &amp; logError methods as promises. | ## Properties | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [findRoute](./rest.defaultsequence.findroute.md) | | <code>FindRoute</code> | | | [invoke](./rest.defaultsequence.invoke.md) | | <code>InvokeMethod</code> | | | [parseParams](./rest.defaultsequence.parseparams.md) | | <code>ParseParams</code> | | | [reject](./rest.defaultsequence.reject.md) | | <code>Reject</code> | | | [send](./rest.defaultsequence.send.md) | | <code>Send</code> | | ## Methods | Method | Modifiers | Description | | --- | --- | --- | | [handle(context)](./rest.defaultsequence.handle.md) | | 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 - 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. | ## 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); ```