Page Contents

Home > @loopback/service-proxy > ServiceMixinDoc > component

ServiceMixinDoc.component() method

Add a component to this application. Also mounts all the components services.

Signature:

component(component: Class<unknown>): Binding;

Parameters

Parameter Type Description
component Class<unknown> The component to add.

Returns:

Binding

Example


export class ProductComponent {
  controllers = [ProductController];
  repositories = [ProductRepo, UserRepo];
  providers = {
    [AUTHENTICATION_STRATEGY]: AuthStrategy,
    [AUTHORIZATION_ROLE]: Role,
  };
};

app.component(ProductComponent);