Initial commit

This commit is contained in:
2026-04-07 11:36:33 +03:00
commit 70f016d113
10 changed files with 4504 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { HealthController } from './health/health.controller';
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
envFilePath: '.env',
}),
],
controllers: [HealthController],
})
export class AppModule {}
+17
View File
@@ -0,0 +1,17 @@
import { IsInt, IsString, Min, Max } from 'class-validator';
export class AppConfig {
@IsString()
NODE_ENV: string = 'development';
@IsInt()
@Min(1)
@Max(65535)
PORT: number = 3000;
@IsString()
APP_NAME: string = 'liquio-qa-bot';
@IsString()
APP_VERSION: string = '1.0.0';
}
+13
View File
@@ -0,0 +1,13 @@
import { Controller, Get } from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
@ApiTags('health')
@Controller()
export class HealthController {
@Get('healthz')
@ApiOperation({ summary: 'Health check' })
@ApiResponse({ status: 200, description: 'Service is healthy' })
healthz(): { status: string } {
return { status: 'ok' };
}
}
+31
View File
@@ -0,0 +1,31 @@
import { NestFactory } from '@nestjs/core';
import { ConfigService } from '@nestjs/config';
import { ValidationPipe } from '@nestjs/common';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useGlobalPipes(new ValidationPipe({ transform: true }));
const config = app.get(ConfigService);
const port = config.get<number>('PORT', 3000);
const appName = config.get<string>('APP_NAME', 'liquio-qa-bot');
const appVersion = config.get<string>('APP_VERSION', '1.0.0');
const swaggerConfig = new DocumentBuilder()
.setTitle(appName)
.setDescription(`${appName} API`)
.setVersion(appVersion)
.build();
const document = SwaggerModule.createDocument(app, swaggerConfig);
SwaggerModule.setup('api', app, document);
await app.listen(port);
console.log(`Application running on port ${port}`);
console.log(`Swagger UI available at http://localhost:${port}/api`);
}
bootstrap();