auth/src/main.ts

34 lines
1.1 KiB
TypeScript
Raw Normal View History

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-04 10:16:34 +00:00
'modules/newauthentication/interface/grpc-controllers/authentication.proto',
2023-04-04 08:14:41 +00:00
),
join(
__dirname,
'modules/authorization/adapters/primaries/authorization.proto',
),
join(__dirname, 'modules/health/adapters/primaries/health.proto'),
],
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();