Files
mtusi2026lab3/src/main.ts
T
2026-11-01 13:37:02 +03:00

34 lines
864 B
TypeScript

import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import {
FastifyAdapter,
NestFastifyApplication,
} from '@nestjs/platform-fastify';
import { AppModule } from './app.module';
import { configureApp } from './configure-app';
import { setupSwagger } from './docs/swagger';
async function bootstrap(): Promise<void> {
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter(),
{
bufferLogs: true,
},
);
configureApp(app);
setupSwagger(app);
app.enableShutdownHooks();
const host = process.env.APP_HOST ?? '0.0.0.0';
const port = Number(process.env.APP_PORT ?? 8080);
await app.listen(port, host);
Logger.log(`Listening on http://${host}:${port}`, 'Bootstrap');
}
bootstrap().catch((error) => {
Logger.error('Fatal error during bootstrap', error);
process.exit(1);
});