@loopback/docs
Version:
Documentation for LoopBack 4
50 lines (32 loc) • 1.28 kB
Markdown
lang: en
title: 'API docs: core.application.servers'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.core.application.servers.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/core](./core.md) > [Application](./core.application.md) > [servers](./core.application.servers.md)
## Application.servers() method
Bind an array of Server constructors to the Application's master context. Each server added in this way will automatically be named based on the class constructor name with the "servers." prefix.
<b>Signature:</b>
```typescript
servers<T extends Server>(ctors: Constructor<T>[]): Binding[];
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| ctors | <code>Constructor<T>[]</code> | An array of Server constructors. |
<b>Returns:</b>
`Binding[]`
An array of bindings for the registered server classes
## Remarks
If you wish to control the binding keys for particular server instances, use the app.server function instead.
```ts
app.servers([
RestServer,
GRPCServer,
]);
// Creates a binding for "servers.RestServer" and a binding for
// "servers.GRPCServer";
```