Skip to content
Snippets Groups Projects
Commit 10d0731e authored by Lukáš Kratochvíl's avatar Lukáš Kratochvíl
Browse files

feat: Swagger page init

parent 6bff9ec0
No related branches found
No related tags found
No related merge requests found
......@@ -2,16 +2,28 @@ import { NestFactory } from '@nestjs/core';
import { ConfigService } from '@nestjs/config';
import { AppModule } from './app.module';
import { ValidationPipe } from '@nestjs/common';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule);
const configService = app.get(ConfigService);
app.useGlobalPipes(
new ValidationPipe({
transform: true,
}),
);
const swaggerDocConfig = new DocumentBuilder()
.setTitle('Movie Base API')
.setVersion('1.0')
.addTag('movies')
.addTag('directors')
.addTag('categories')
.build();
const swaggerDoc = SwaggerModule.createDocument(app, swaggerDocConfig);
SwaggerModule.setup('/', app, swaggerDoc);
const port = configService.get<number>('PORT') | 4000;
console.log(`NestJS server is listening on: http://localhost:${port}`);
await app.listen(port);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment