23 lines
729 B
TypeScript
23 lines
729 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
|
import { AppModule } from './app.module';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule, {
|
|
cors: true
|
|
});
|
|
app.enableCors()
|
|
app.useGlobalPipes(new ValidationPipe({ transform: true }))
|
|
const config = new DocumentBuilder()
|
|
.setTitle('Fuel API')
|
|
.setDescription('API test')
|
|
.setVersion('0.1')
|
|
.addTag('test')
|
|
.build()
|
|
const documentFactory = () => SwaggerModule.createDocument(app, config)
|
|
SwaggerModule.setup('docs', app, documentFactory)
|
|
|
|
await app.listen(process.env.API_PORT ?? 3000);
|
|
}
|
|
bootstrap(); |