2023-05-03 11:43:21 +00:00
|
|
|
import { NestFactory } from '@nestjs/core';
|
2023-05-03 15:31:26 +00:00
|
|
|
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
|
|
|
import { join } from 'path';
|
2023-05-03 11:43:21 +00:00
|
|
|
import { AppModule } from './app.module';
|
|
|
|
|
|
|
|
async function bootstrap() {
|
|
|
|
const app = await NestFactory.create(AppModule);
|
2023-05-03 15:31:26 +00:00
|
|
|
app.connectMicroservice<MicroserviceOptions>({
|
|
|
|
transport: Transport.TCP,
|
|
|
|
});
|
|
|
|
app.connectMicroservice<MicroserviceOptions>({
|
|
|
|
transport: Transport.GRPC,
|
|
|
|
options: {
|
|
|
|
// package: ['ad', 'health'],
|
|
|
|
package: ['health'],
|
|
|
|
protoPath: [
|
|
|
|
// join(__dirname, 'modules/ad/adapters/primaries/ad.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);
|
2023-05-03 11:43:21 +00:00
|
|
|
}
|
|
|
|
bootstrap();
|