feat: init after lab 1

This commit is contained in:
2026-10-01 19:29:22 +03:00
parent 65003b6119
commit f743ee10a2
44 changed files with 8111 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import {
FastifyAdapter,
NestFastifyApplication,
} from '@nestjs/platform-fastify';
import { AppModule } from './app.module.js';
import { ApiExceptionFilter } from './common/errors/api-exception.filter.js';
import { RequestIdInterceptor } from './common/http/request-id.interceptor.js';
async function bootstrap() {
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter({
logger: true,
}),
);
app.useGlobalInterceptors(new RequestIdInterceptor());
app.useGlobalFilters(new ApiExceptionFilter());
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
forbidNonWhitelisted: true,
transform: true,
}),
);
app.enableShutdownHooks();
const port = Number(process.env.APP_PORT ?? '8080');
const host = process.env.APP_HOST ?? '0.0.0.0';
if (!Number.isInteger(port) || port < 1 || port > 65535) {
throw new Error('APP_PORT must be an integer between 1 and 65535');
}
await app.listen(port, host);
}
await bootstrap();