/
githubmirror
/
nest
Обзор
Документация
Войти
/
githubmirror
/
nest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
sample/04-grpc/src/main.ts
28 строк
934 B
Kamil Myśliwiec
fix(microservices): reject on error (on listen method call)
28 янв 2021, 16:00
Не верифицирован
28 янв 2021, 16:00
9241905
Код
Авторство
О чём код?
import { NestFactory } from '@nestjs/core'; import { MicroserviceOptions } from '@nestjs/microservices'; import { AppModule } from './app.module'; import { grpcClientOptions } from './grpc-client.options'; async function bootstrap() { /** * This example contains a hybrid application (HTTP + gRPC) * You can switch to a microservice with NestFactory.createMicroservice() as follows: * * const app = await NestFactory.createMicroservice<MicroserviceOptions>(AppModule, { * transport: Transport.GRPC, * options: { * package: 'hero', * protoPath: join(__dirname, './hero/hero.proto'), * } * }); * await app.listen(); * */ const app = await NestFactory.create(AppModule); app.connectMicroservice<MicroserviceOptions>(grpcClientOptions); await app.startAllMicroservices(); await app.listen(3001); console.log(`Application is running on: ${await app.getUrl()}`); } bootstrap();