2026-10-13 18:13:49 -05:00
|
|
|
import { NestFactory } from '@nestjs/core';
|
|
|
|
|
import type { LogLevel } from '@nestjs/common';
|
2026-10-13 19:04:52 -05:00
|
|
|
import type { NestExpressApplication } from '@nestjs/platform-express';
|
2026-10-13 18:13:49 -05:00
|
|
|
import { AppModule } from './app.module.js';
|
2026-10-13 19:04:52 -05:00
|
|
|
import { configureApp } from './app.setup.js';
|
2026-10-13 18:13:49 -05:00
|
|
|
import { AppConfigService } from './config/app-config.service.js';
|
|
|
|
|
|
|
|
|
|
const LOG_LEVELS: LogLevel[] = ['error', 'warn', 'log', 'debug', 'verbose'];
|
|
|
|
|
|
|
|
|
|
async function bootstrap() {
|
2026-10-13 19:04:52 -05:00
|
|
|
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
2026-10-13 18:13:49 -05:00
|
|
|
const config = app.get(AppConfigService);
|
|
|
|
|
|
2026-10-13 19:04:52 -05:00
|
|
|
configureApp(app);
|
2026-10-13 18:13:49 -05:00
|
|
|
app.useLogger(LOG_LEVELS.slice(0, LOG_LEVELS.indexOf(config.get('LOG_LEVEL')) + 1));
|
|
|
|
|
app.enableCors({ origin: config.get('CORS_ORIGINS') });
|
|
|
|
|
app.enableShutdownHooks();
|
|
|
|
|
|
|
|
|
|
await app.listen(config.get('PORT'));
|
|
|
|
|
}
|
|
|
|
|
await bootstrap();
|