UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

50 lines (33 loc) 1.45 kB
--- lang: en title: 'API docs: core.application.servers' 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.servers.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; [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 | [Constructor](./context.constructor.md)<!-- -->&lt;T&gt;\[\] | An array of Server constructors. | <b>Returns:</b> [Binding](./context.binding.md)<!-- -->\[\] 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"; ```