24 lines
735 B
TypeScript
24 lines
735 B
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
|
import { AppModule } from './app.module';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule);
|
|
|
|
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
|
|
app.enableCors();
|
|
|
|
const config = new DocumentBuilder()
|
|
.setTitle('toir-light-v7 API')
|
|
.setDescription('Auto-generated CRUD API for toir-light-v7')
|
|
.setVersion('1.0')
|
|
.addBearerAuth()
|
|
.build();
|
|
const document = SwaggerModule.createDocument(app, config);
|
|
SwaggerModule.setup('api/docs', app, document);
|
|
|
|
await app.listen(3000);
|
|
}
|
|
bootstrap();
|