24 lines
830 B
TypeScript
24 lines
830 B
TypeScript
import { NestFactory, Reflector } from '@nestjs/core'
|
|
import { AppModule } from './app.module'
|
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'
|
|
import { ClassSerializerInterceptor, ValidationPipe } from '@nestjs/common'
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create(AppModule)
|
|
|
|
app.useGlobalPipes(new ValidationPipe({ transform: true }))
|
|
app.useGlobalInterceptors(new ClassSerializerInterceptor(app.get(Reflector)))
|
|
|
|
const config = new DocumentBuilder()
|
|
.setTitle('Traintrape-moi')
|
|
.setDescription('API permettant de stocker les données de Traintrape-moi')
|
|
.setVersion('1.0')
|
|
.addBearerAuth()
|
|
.build()
|
|
const document = SwaggerModule.createDocument(app, config)
|
|
|
|
SwaggerModule.setup('', app, document)
|
|
await app.listen(process.env.PORT ?? 3000)
|
|
}
|
|
bootstrap()
|