@loopback/docs
Version:
Documentation for LoopBack 4
136 lines (117 loc) • 9.05 kB
Markdown
---
lang: en
title: 'API docs: rest'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.rest.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/rest](./rest.md)
## rest package
[@loopback/rest](https://github.com/strongloop/loopback-next/tree/master/packages/rest)
## Classes
| Class | Description |
| --- | --- |
| [BaseRoute](./rest.baseroute.md) | Base implementation of RouteEntry |
| [BindElementProvider](./rest.bindelementprovider.md) | |
| [ControllerRoute](./rest.controllerroute.md) | A route backed by a controller |
| [DefaultSequence](./rest.defaultsequence.md) | The default implementation of SequenceHandler. |
| [FindRouteProvider](./rest.findrouteprovider.md) | |
| [GetFromContextProvider](./rest.getfromcontextprovider.md) | |
| [HttpHandler](./rest.httphandler.md) | |
| [InvokeMethodProvider](./rest.invokemethodprovider.md) | |
| [JsonBodyParser](./rest.jsonbodyparser.md) | |
| [LogErrorProvider](./rest.logerrorprovider.md) | |
| [ParseParamsProvider](./rest.parseparamsprovider.md) | Provides the function for parsing args in requests at runtime. |
| [RawBodyParser](./rest.rawbodyparser.md) | Parsing the request body into Buffer |
| [RedirectRoute](./rest.redirectroute.md) | |
| [RegExpRouter](./rest.regexprouter.md) | Router implementation based on regexp matching |
| [RejectProvider](./rest.rejectprovider.md) | |
| [RequestBodyParser](./rest.requestbodyparser.md) | |
| [RequestContext](./rest.requestcontext.md) | A per-request Context combining an IoC container with handler context (request, response, etc.). |
| [RestApplication](./rest.restapplication.md) | An implementation of the Application class that automatically provides an instance of a REST server. This application class is intended to be a single-server implementation. Any attempt to bind additional servers will throw an error. |
| [RestComponent](./rest.restcomponent.md) | |
| [RestServer](./rest.restserver.md) | A REST API server for use with Loopback. Add this server to your application by importing the RestComponent. |
| [Route](./rest.route.md) | |
| [RoutingTable](./rest.routingtable.md) | Routing table |
| [SendProvider](./rest.sendprovider.md) | Provides the function that populates the response object with the results of the operation. |
| [StreamBodyParser](./rest.streambodyparser.md) | A special body parser to retain request stream as is. It will be used by explicitly setting <code>x-parser</code> to <code>'stream'</code> in the request body spec. |
| [TextBodyParser](./rest.textbodyparser.md) | |
| [Trie](./rest.trie.md) | An implementation of trie for routes. The key hierarchy is built with parts of the route path delimited by <code>/</code> |
| [TrieRouter](./rest.trierouter.md) | Router implementation based on trie |
| [UrlEncodedBodyParser](./rest.urlencodedbodyparser.md) | |
## Functions
| Function | Description |
| --- | --- |
| [assignRouterSpec(target, additions)](./rest.assignrouterspec.md) | |
| [compareRoute(route1, route2)](./rest.compareroute.md) | Compare two routes by verb/path for sorting |
| [createBodyParserBinding(parserClass, key)](./rest.createbodyparserbinding.md) | Create a binding for the given body parser class |
| [createControllerFactoryForBinding(key)](./rest.createcontrollerfactoryforbinding.md) | Create a controller factory function for a given binding key |
| [createControllerFactoryForClass(controllerCtor)](./rest.createcontrollerfactoryforclass.md) | Create a controller factory function for a given class |
| [createControllerFactoryForInstance(controllerInst)](./rest.createcontrollerfactoryforinstance.md) | Create a controller factory function for a given instance |
| [createResolvedRoute(route, pathParams)](./rest.createresolvedroute.md) | |
| [getPathVariables(path)](./rest.getpathvariables.md) | Get all path variables. For example, <code>/root/{foo}/bar</code> =<!-- -->> <code>['foo']</code> |
| [parseJson(text, reviver)](./rest.parsejson.md) | |
| [parseOperationArgs(request, route, requestBodyParser)](./rest.parseoperationargs.md) | Parses the request to derive arguments to be passed in for the Application controller method |
| [rebaseOpenApiSpec(spec, basePath)](./rest.rebaseopenapispec.md) | |
| [sanitizeJsonParse(reviver)](./rest.sanitizejsonparse.md) | Factory to create a reviver function for <code>JSON.parse</code> to sanitize keys |
| [toExpressPath(path)](./rest.toexpresspath.md) | Convert an OpenAPI path to Express (path-to-regexp) style |
| [validateApiPath(path)](./rest.validateapipath.md) | Validate the path to be compatible with OpenAPI path template. No parameter modifier, custom pattern, or unnamed parameter is allowed. |
| [writeResultToResponse(response, result)](./rest.writeresulttoresponse.md) | Writes the result from Application controller method into the HTTP response |
## Interfaces
| Interface | Description |
| --- | --- |
| [ApiExplorerOptions](./rest.apiexploreroptions.md) | |
| [BodyParser](./rest.bodyparser.md) | Interface to be implemented by body parser extensions |
| [HandlerContext](./rest.handlercontext.md) | An object holding HTTP request, response and other data needed to handle an incoming HTTP request. |
| [HttpServerLike](./rest.httpserverlike.md) | |
| [Node](./rest.node.md) | A Node in the trie |
| [OpenApiSpecForm](./rest.openapispecform.md) | The form of OpenAPI specs to be served |
| [OpenApiSpecOptions](./rest.openapispecoptions.md) | Options to customize how OpenAPI specs are served |
| [RequestBodyParserOptions](./rest.requestbodyparseroptions.md) | Options for request body parsing See https://github.com/expressjs/body-parser/\#options |
| [ResolvedNode](./rest.resolvednode.md) | |
| [ResolvedRoute](./rest.resolvedroute.md) | A route with path parameters resolved |
| [RestRouter](./rest.restrouter.md) | |
| [RestServerResolvedOptions](./rest.restserverresolvedoptions.md) | |
| [RouteEntry](./rest.routeentry.md) | An entry in the routing table |
| [SequenceHandler](./rest.sequencehandler.md) | A sequence handler is a class implementing sequence of actions required to handle an incoming request. |
## Namespaces
| Namespace | Description |
| --- | --- |
| [RestBindings](./rest.restbindings.md) | RestServer-specific bindings |
| [RestHttpErrors](./rest.resthttperrors.md) | |
## Variables
| Variable | Description |
| --- | --- |
| [ERR\_NO\_MULTI\_SERVER](./rest.err_no_multi_server.md) | |
| [REQUEST\_BODY\_PARSER\_TAG](./rest.request_body_parser_tag.md) | Binding tag for request body parser extensions |
| [SequenceActions](./rest.sequenceactions.md) | |
## Type Aliases
| Type Alias | Description |
| --- | --- |
| [BindElement](./rest.bindelement.md) | |
| [BodyParserFunction](./rest.bodyparserfunction.md) | Plain function for body parsing |
| [ControllerClass](./rest.controllerclass.md) | Controller class |
| [ControllerFactory](./rest.controllerfactory.md) | A factory function to create controller instances synchronously or asynchronously |
| [ControllerInstance](./rest.controllerinstance.md) | |
| [ExpressRequestHandler](./rest.expressrequesthandler.md) | |
| [FindRoute](./rest.findroute.md) | Find a route matching the incoming request. Throw an error when no route was found. |
| [GetFromContext](./rest.getfromcontext.md) | |
| [HttpRequestListener](./rest.httprequestlistener.md) | |
| [InvokeMethod](./rest.invokemethod.md) | Invokes a method defined in the Application Controller |
| [LogError](./rest.logerror.md) | Log information about a failed request. |
| [NodeWithValue](./rest.nodewithvalue.md) | |
| [OperationArgs](./rest.operationargs.md) | |
| [OperationRetval](./rest.operationretval.md) | Return value of a controller method (a function implementing an operation). This is a type alias for "any", used to distinguish operation results from other "any" typed values. |
| [ParseParams](./rest.parseparams.md) | |
| [PathParameterValues](./rest.pathparametervalues.md) | |
| [Reject](./rest.reject.md) | Reject the request with an error. |
| [RequestBody](./rest.requestbody.md) | Request body with metadata |
| [RestComponentConfig](./rest.restcomponentconfig.md) | |
| [RestRouterOptions](./rest.restrouteroptions.md) | |
| [RestServerConfig](./rest.restserverconfig.md) | Valid configuration for the RestServer constructor. |
| [RestServerOptions](./rest.restserveroptions.md) | RestServer options |
| [RestServerResolvedConfig](./rest.restserverresolvedconfig.md) | |
| [RouterSpec](./rest.routerspec.md) | |
| [Send](./rest.send.md) | Send the operation response back to the client. |
| [SequenceFunction](./rest.sequencefunction.md) | A sequence function is a function implementing a custom sequence of actions to handle an incoming request. |