nestjs rewrite
This commit is contained in:
23
server/src/main.ts
Normal file
23
server/src/main.ts
Normal file
@ -0,0 +1,23 @@
|
||||
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.PORT ?? 3000);
|
||||
}
|
||||
bootstrap();
|
Reference in New Issue
Block a user