---
lang: en
title: 'API docs: rest.restapplication'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/rest
permalink: /doc/en/lb4/apidocs.rest.restapplication.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/rest](./rest.md) &gt; [RestApplication](./rest.restapplication.md)

## RestApplication class

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.

<b>Signature:</b>

```typescript
export declare class RestApplication extends Application implements HttpServerLike 
```

## Constructors

|  Constructor | Modifiers | Description |
|  --- | --- | --- |
|  [(constructor)(parent)](./rest.restapplication._constructor_.md) |  | Create a REST application with the given parent context |
|  [(constructor)(config, parent)](./rest.restapplication._constructor__1.md) |  | Create a REST application with the given configuration and parent context |

## Properties

|  Property | Modifiers | Type | Description |
|  --- | --- | --- | --- |
|  [requestHandler](./rest.restapplication.requesthandler.md) |  | <code>HttpRequestListener</code> | Handle incoming HTTP(S) request by invoking the corresponding Controller method via the configured Sequence. |
|  [restServer](./rest.restapplication.restserver.md) |  | <code>RestServer</code> | The main REST server instance providing REST API for this application. |

## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  [api(spec)](./rest.restapplication.api.md) |  | Set the OpenAPI specification that defines the REST API schema for this application. All routes, parameter definitions and return types will be defined in this way.<!-- -->Note that this will override any routes defined via decorators at the controller level (this function takes precedent). |
|  [basePath(path)](./rest.restapplication.basepath.md) |  | Configure the <code>basePath</code> for the rest server |
|  [bodyParser(bodyParserClass, address)](./rest.restapplication.bodyparser.md) |  | Bind a body parser to the server context |
|  [handler(handlerFn)](./rest.restapplication.handler.md) |  |  |
|  [mountExpressRouter(basePath, router, spec)](./rest.restapplication.mountexpressrouter.md) |  | Mount an Express router to expose additional REST endpoints handled via legacy Express-based stack. |
|  [redirect(fromPath, toPathOrUrl, statusCode)](./rest.restapplication.redirect.md) |  | Register a route redirecting callers to a different URL. |
|  [route(verb, path, spec, controllerCtor, controllerFactory, methodName)](./rest.restapplication.route.md) |  | Register a new Controller-based route. |
|  [route(verb, path, spec, handler)](./rest.restapplication.route_1.md) |  | Register a new route invoking a handler function. |
|  [route(route)](./rest.restapplication.route_2.md) |  | Register a new route. |
|  [route(verb, path, spec, handler)](./rest.restapplication.route_3.md) |  | Register a new route. |
|  [sequence(sequence)](./rest.restapplication.sequence.md) |  |  |
|  [server(server, name)](./rest.restapplication.server.md) |  |  |
|  [static(path, rootDir, options)](./rest.restapplication.static.md) |  | Mount static assets to the REST server. See https://expressjs.com/en/4x/api.html\#express.static |


