---
lang: en
title: 'API docs: core.application.server'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/core
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>, nameOrOptions?: string | BindingFromClassOptions): Binding<T>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  ctor | [Constructor](./context.constructor.md)<!-- -->&lt;T&gt; |  |
|  nameOrOptions | string \| [BindingFromClassOptions](./context.bindingfromclassoptions.md) | Optional override for name or options. |

<b>Returns:</b>

[Binding](./context.binding.md)<!-- -->&lt;T&gt;

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".
```


