/
githubmirror
/
nest
Обзор
Документация
Войти
/
githubmirror
/
nest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
sample/03-microservices/src/main.ts
27 строк
903 B
Kamil Myśliwiec
sample: revert microservices sample local updates
25 ноя 2024, 16:28
Не верифицирован
25 ноя 2024, 16:28
8ffae00
Код
Авторство
О чём код?
import { NestFactory } from '@nestjs/core'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import { AppModule } from './app.module'; async function bootstrap() { /** * This example contains a hybrid application (HTTP + TCP) * You can switch to a microservice with NestFactory.createMicroservice() as follows: * * const app = await NestFactory.createMicroservice<MicroserviceOptions>(AppModule, { * transport: Transport.TCP, * options: { retryAttempts: 5, retryDelay: 3000 }, * }); * await app.listen(); * */ const app = await NestFactory.create(AppModule); app.connectMicroservice<MicroserviceOptions>({ transport: Transport.TCP, options: { retryAttempts: 5, retryDelay: 3000 }, }); await app.startAllMicroservices(); await app.listen(3001); console.log(`Application is running on: ${await app.getUrl()}`); } bootstrap();