---
lang: en
title: 'API docs: core.application.server'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.core.application.server.html
---

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

[Home](./index.md) &gt; [@loopback/core](./core.md) &gt; [Application](./core.application.md) &gt; [server](./core.application.server.md)

## Application.server() method

Bind a Server constructor to the Application's master context. Each server constructor added in this way must provide a unique prefix to prevent binding overlap.

<b>Signature:</b>

```typescript
server<T extends Server>(ctor: Constructor<T>, name?: string): Binding<T>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  ctor | <code>Constructor&lt;T&gt;</code> |  |
|  name | <code>string</code> | Optional override for key name. |

<b>Returns:</b>

`Binding<T>`

Binding for the server class

## Example


```ts
app.server(RestServer);
// This server constructor will be bound under "servers.RestServer".
app.server(RestServer, "v1API");
// This server instance will be bound under "servers.v1API".

```


