29 lines
921 B
TypeScript
29 lines
921 B
TypeScript
|
import { NestFactory } from '@nestjs/core';
|
||
|
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||
|
import { join } from 'path';
|
||
|
import { AppModule } from './app.module';
|
||
|
|
||
|
async function bootstrap() {
|
||
|
const app = await NestFactory.create(AppModule);
|
||
|
app.connectMicroservice<MicroserviceOptions>({
|
||
|
transport: Transport.TCP,
|
||
|
});
|
||
|
app.connectMicroservice<MicroserviceOptions>({
|
||
|
transport: Transport.GRPC,
|
||
|
options: {
|
||
|
// package: ['matcher', 'health'],
|
||
|
package: ['health'],
|
||
|
protoPath: [
|
||
|
// join(__dirname, 'modules/matcher/adapters/primaries/matcher.proto'),
|
||
|
join(__dirname, 'modules/health/adapters/primaries/health.proto'),
|
||
|
],
|
||
|
url: process.env.SERVICE_URL + ':' + process.env.SERVICE_PORT,
|
||
|
loader: { keepCase: true },
|
||
|
},
|
||
|
});
|
||
|
|
||
|
await app.startAllMicroservices();
|
||
|
await app.listen(process.env.HEALTH_SERVICE_PORT);
|
||
|
}
|
||
|
bootstrap();
|