@sigmaott/service
v3.4.17
Published
Service package for sigma ott
Downloads
346
Readme
@sigmaott/service
Package chứa các module grpc service
Usage
Import module
import { Module } from '@nestjs/common';
import {
GrpcAssetServiceModule,
GrpcTranscodeChannelServiceModule,
} from '@sigmaott/service';
import * as config from 'config';
@Module({
imports: [
GrpcAssetServiceModule.forRoot(GrpcAssetServiceModule, {
serviceUri: config.get('grpc.asset_service_uri'),
cache: {
enable: true,
ttl: 60, // seconds
},
retry: {
enable: true,
maxRetryAttempts: 3,
},
}),
],
exports: [GrpcAssetServiceModule],
})
export class GrcServicesModule {}
Inject Service
import { GrpcAssetService } from '@sigmaott/service';
export class FooService {
constructor(private readonly assetService: GrpcAssetService) {}
async findAsset () {
const { asset } = await this.assetService.svc.findAsset({id: xxxx }).toPromise()
}
}