Files
basic-erp/apps/api/src/main.ts
T

21 lines
808 B
TypeScript
Raw Normal View History

import { NestFactory } from '@nestjs/core';
import type { LogLevel } from '@nestjs/common';
import type { NestExpressApplication } from '@nestjs/platform-express';
import { AppModule } from './app.module.js';
import { configureApp } from './app.setup.js';
import { AppConfigService } from './config/app-config.service.js';
const LOG_LEVELS: LogLevel[] = ['error', 'warn', 'log', 'debug', 'verbose'];
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule);
const config = app.get(AppConfigService);
configureApp(app);
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();