@loopback/docs
Version:
Documentation for LoopBack 4
52 lines (33 loc) • 1.18 kB
Markdown
lang: en
title: 'API docs: service-proxy.servicemixindoc.component'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.service-proxy.servicemixindoc.component.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/service-proxy](./service-proxy.md) > [ServiceMixinDoc](./service-proxy.servicemixindoc.md) > [component](./service-proxy.servicemixindoc.component.md)
## ServiceMixinDoc.component() method
Add a component to this application. Also mounts all the components services.
<b>Signature:</b>
```typescript
component(component: Class<unknown>): Binding;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| component | <code>Class<unknown></code> | The component to add. |
<b>Returns:</b>
`Binding`
## Example
```ts
export class ProductComponent {
controllers = [ProductController];
repositories = [ProductRepo, UserRepo];
providers = {
[AUTHENTICATION_STRATEGY]: AuthStrategy,
[AUTHORIZATION_ROLE]: Role,
};
};
app.component(ProductComponent);
```