* Add a service to this application. * * @param cls - The service or provider class * * @example * * ```ts * // Define a class to be bound via ctx.toClass() * @injectable({scope: BindingScope.SINGLETON}) * export class LogService { * log(msg: string) { * consol
(
cls: ServiceOrProviderClass<S>,
nameOrOptions?: string | ServiceOptions,
)
| 558 | * ``` |
| 559 | */ |
| 560 | public service<S>( |
| 561 | cls: ServiceOrProviderClass<S>, |
| 562 | nameOrOptions?: string | ServiceOptions, |
| 563 | ): Binding<S> { |
| 564 | const options = toOptions(nameOrOptions); |
| 565 | const binding = createServiceBinding(cls, options); |
| 566 | this.add(binding); |
| 567 | return binding; |
| 568 | } |
| 569 | |
| 570 | /** |
| 571 | * Register an interceptor |
no test coverage detected