NestJS · Junior · Question 4 of 75
What does main.ts usually contain in a Nest app?
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(process.env.PORT ?? 3000);
}
bootstrap();- ✓Correct answer: The bootstrap code: it creates the application from the root module and starts the HTTP server
- 2All controllers of the application
- 3The database schema
Explanation
Global settings also go here: app.setGlobalPrefix('api'), app.useGlobalPipes(...), app.enableCors(), Swagger setup.