Skip to content

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

ParameterTypeDescription
configMicroserviceConfigurationTransport configuration for the client to connect to.

Returns

PropertyDecorator

Example

typescript
class AppController {
  @Client({ transport: Transport.REDIS, options: { host: 'localhost' } })
  private client: ClientProxy;
}

Released under the MIT License.