feat: establish backend foundation

This commit is contained in:
2026-08-12 23:04:21 +03:00
parent f8dcfb71c1
commit ab21426478
24 changed files with 2313 additions and 382 deletions
+25 -2
View File
@@ -1,8 +1,31 @@
import { NestFactory } from '@nestjs/core';
import { ConfigService } from '@nestjs/config';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';
import { HttpExceptionFilter } from './common/filters/http-exception.filter';
import { Environment } from './config/env.validation';
import { shouldExposeSwagger } from './config/swagger.config';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(process.env.PORT ?? 3000);
const config = app.get<ConfigService<Environment, true>>(ConfigService);
const frontendOrigin = config.getOrThrow<string>('FRONTEND_ORIGIN');
app.enableCors({ origin: frontendOrigin });
app.setGlobalPrefix('api/v1');
app.useGlobalFilters(new HttpExceptionFilter());
if (shouldExposeSwagger(process.env['NODE_ENV'])) {
const document = SwaggerModule.createDocument(
app,
new DocumentBuilder()
.setTitle('WealthLedger API')
.setVersion('v1')
.build(),
);
SwaggerModule.setup('api/docs', app, document);
}
await app.listen(config.getOrThrow('PORT'));
}
bootstrap();
void bootstrap();