* 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. * * @example * ```ts * app.server(RestServer); * // This server constructor will be bound under "servers.RestSe
(
ctor: Constructor<T>,
nameOrOptions?: string | BindingFromClassOptions,
)
| 194 | * |
| 195 | */ |
| 196 | public server<T extends Server>( |
| 197 | ctor: Constructor<T>, |
| 198 | nameOrOptions?: string | BindingFromClassOptions, |
| 199 | ): Binding<T> { |
| 200 | this.debug('Adding server %s', nameOrOptions ?? ctor.name); |
| 201 | const binding = createBindingFromClass(ctor, { |
| 202 | namespace: CoreBindings.SERVERS, |
| 203 | type: CoreTags.SERVER, |
| 204 | defaultScope: BindingScope.SINGLETON, |
| 205 | ...toOptions(nameOrOptions), |
| 206 | }).apply(asLifeCycleObserver); |
| 207 | this.add(binding); |
| 208 | return binding; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Bind an array of Server constructors to the Application's master |
no test coverage detected