Function: Client()
ts
function Client(config): PropertyDecorator;Defined in: packages/microservices/src/decorators/client.decorator.ts:20
Marks a class property for automatic ClientProxy injection. The injected client is created using config and is ready to use after the application starts.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | MicroserviceConfiguration | Transport configuration for the client to connect to. |
Returns
PropertyDecorator
Example
typescript
class AppController {
@Client({ transport: Transport.REDIS, options: { host: 'localhost' } })
private client: ClientProxy;
}