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: Constructor<unknown>): Binding;
Parameters
Parameter | Type | Description |
---|---|---|
component | Constructor<unknown> | The component to add. |
Returns:
Example
export class ProductComponent {
controllers = [ProductController];
repositories = [ProductRepo, UserRepo];
providers = {
[AUTHENTICATION_STRATEGY]: AuthStrategy,
[AUTHORIZATION_ROLE]: Role,
};
};
app.component(ProductComponent);