2022-12-15 09:59:45 +00:00
|
|
|
import { NestFactory } from '@nestjs/core';
|
2022-12-16 15:46:14 +00:00
|
|
|
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
|
|
|
import { join } from 'path';
|
2022-12-15 09:59:45 +00:00
|
|
|
import { AppModule } from './app.module';
|
|
|
|
|
|
|
|
async function bootstrap() {
|
2023-04-04 08:14:41 +00:00
|
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
app.connectMicroservice<MicroserviceOptions>({
|
|
|
|
transport: Transport.TCP,
|
|
|
|
});
|
|
|
|
app.connectMicroservice<MicroserviceOptions>({
|
|
|
|
transport: Transport.GRPC,
|
|
|
|
options: {
|
|
|
|
package: ['authentication', 'authorization', 'health'],
|
|
|
|
protoPath: [
|
|
|
|
join(
|
|
|
|
__dirname,
|
2023-07-06 14:23:18 +00:00
|
|
|
'modules/authentication/interface/grpc-controllers/authentication.proto',
|
2023-04-04 08:14:41 +00:00
|
|
|
),
|
|
|
|
join(
|
|
|
|
__dirname,
|
2023-07-12 08:39:55 +00:00
|
|
|
'modules/authorization/interface/grpc-controllers/authorization.proto',
|
|
|
|
),
|
|
|
|
join(
|
|
|
|
__dirname,
|
|
|
|
'modules/health/interface/grpc-controllers/health.proto',
|
2023-04-04 08:14:41 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
url: process.env.SERVICE_URL + ':' + process.env.SERVICE_PORT,
|
|
|
|
loader: { keepCase: true, enums: String },
|
2022-12-16 15:46:14 +00:00
|
|
|
},
|
2023-04-04 08:14:41 +00:00
|
|
|
});
|
|
|
|
await app.startAllMicroservices();
|
|
|
|
await app.listen(process.env.HEALTH_SERVICE_PORT);
|
2022-12-15 09:59:45 +00:00
|
|
|
}
|
|
|
|
bootstrap();
|