forked from nestjs/nest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
26 lines (24 loc) · 768 Bytes
/
Copy pathmain.ts
File metadata and controls
26 lines (24 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { NestFactory } from '@nestjs/core';
import { Transport } from '@nestjs/microservices';
import { ApplicationModule } from './app.module';
async function bootstrap() {
/**
* Hybrid application (HTTP + TCP)
* Switch to basic microservice with NestFactory.createMicroservice():
*
* const app = await NestFactory.createMicroservice(ApplicationModule, {
* transport: Transport.TCP,
* options: { retryAttempts: 5, retryDelay: 3000 },
* });
* await app.listenAsync();
*
*/
const app = await NestFactory.create(ApplicationModule);
app.connectMicroservice({
transport: Transport.TCP,
options: { retryAttempts: 5, retryDelay: 3000 },
});
await app.startAllMicroservicesAsync();
await app.listen(3001);
}
bootstrap();