Page Contents
Home > @loopback/core > Application > servers
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.
Signature:
servers<T extends Server>(ctors: Constructor<T>[]): Binding[];
Parameters
Parameter | Type | Description |
---|---|---|
ctors | Constructor<T>[] | An array of Server constructors. |
Returns:
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.
app.servers([
RestServer,
GRPCServer,
]);
// Creates a binding for "servers.RestServer" and a binding for
// "servers.GRPCServer";