2023-04-06 09:12:49 +00:00
|
|
|
import { NestFactory } from '@nestjs/core';
|
|
|
|
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
2023-04-06 15:05:25 +00:00
|
|
|
import { join } from 'path';
|
2023-04-06 09:12:49 +00:00
|
|
|
import { AppModule } from './app.module';
|
|
|
|
|
|
|
|
async function bootstrap() {
|
|
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
app.connectMicroservice<MicroserviceOptions>({
|
|
|
|
transport: Transport.TCP,
|
|
|
|
});
|
2023-04-06 15:05:25 +00:00
|
|
|
app.connectMicroservice<MicroserviceOptions>({
|
|
|
|
transport: Transport.GRPC,
|
|
|
|
options: {
|
2023-08-29 15:28:38 +00:00
|
|
|
package: ['matcher', 'health'],
|
|
|
|
protoPath: [
|
|
|
|
join(__dirname, 'modules/ad/interface/grpc-controllers/matcher.proto'),
|
|
|
|
join(__dirname, 'health.proto'),
|
|
|
|
],
|
2023-04-06 15:05:25 +00:00
|
|
|
url: process.env.SERVICE_URL + ':' + process.env.SERVICE_PORT,
|
2023-08-29 15:28:38 +00:00
|
|
|
loader: { keepCase: true, enums: String },
|
2023-04-06 15:05:25 +00:00
|
|
|
},
|
|
|
|
});
|
2023-04-06 09:12:49 +00:00
|
|
|
|
|
|
|
await app.startAllMicroservices();
|
2023-08-25 14:01:19 +00:00
|
|
|
await app.listen(process.env.HEALTH_SERVICE_PORT as string);
|
2023-04-06 09:12:49 +00:00
|
|
|
}
|
|
|
|
bootstrap();
|