BE/src/main.ts

28 lines
949 B
TypeScript
Raw Normal View History

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
2025-02-25 13:18:33 +05:30
import { ValidationPipe } from '@nestjs/common';
2025-03-07 12:52:51 +05:30
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { SwaggerDocumentOptions } from '@nestjs/swagger';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
2025-02-25 13:18:33 +05:30
app.useGlobalPipes(new ValidationPipe());
2025-03-07 12:52:51 +05:30
const config = new DocumentBuilder()
.setTitle('API')
.setDescription('API description')
.setVersion('1.0')
.addServer("http://localhost:3000", "Development Server 1")
.addServer("https://dev.alphaomegainfosys.com/test-api", "Development Server 2")
.build();
const options: SwaggerDocumentOptions = {
autoTagControllers: false,
};
const documentFactory = () => SwaggerModule.createDocument(app, config, options);
SwaggerModule.setup('api', app, documentFactory);
await app.listen(process.env.PORT ?? 3000);
}
bootstrap();