MCPcopy
hub / github.com/loopbackio/loopback-next / service

Method service

packages/core/src/application.ts:560–568  ·  view source on GitHub ↗

* 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,
  )

Source from the content-addressed store, hash-verified

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

Callers 3

mountComponentFunction · 0.45
loadMethod · 0.45
serviceProviderMethod · 0.45

Calls 3

createServiceBindingFunction · 0.90
toOptionsFunction · 0.70
addMethod · 0.65

Tested by

no test coverage detected