24 lines
598 B
TypeScript
Raw Normal View History

import { LogLevel } from '@nestjs/common';
2021-09-06 17:10:06 +02:00
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
function isLogLevel(value: any): value is LogLevel {
return value in ['log', 'error', 'warn', 'debug', 'verbose'];
}
2021-09-06 17:10:06 +02:00
async function bootstrap() {
const logLevel = isLogLevel(process.env.LOG_LEVEL)
? process.env.LOG_LEVEL
2021-11-26 19:35:45 +01:00
: 'log';
const app = await NestFactory.create(AppModule, {
cors: true,
logger: [logLevel],
});
2021-09-08 17:17:39 +02:00
app.setGlobalPrefix(process.env.GLOBAL_PREFIX ?? '/api/v2');
2021-09-08 17:17:39 +02:00
await app.listen(process.env.PORT ?? 8080);
2021-09-06 17:10:06 +02:00
}
bootstrap();