Initial commit
This commit is contained in:
+31
@@ -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();
|
||||
Reference in New Issue
Block a user