Skip to content

Commit

Permalink
add openapi Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sk337 committed Feb 3, 2024
1 parent a7edc6b commit 578a1e8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@ import * as passport from 'passport';
import { AppModule } from './app.module';
import { ExcludeInterceptor } from './exclude.interceptor';
import { config } from './config';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import * as fs from 'fs';

async function bootstrap() {
const app = await NestFactory.create(AppModule);

// creates open api documentation at /api
const swaggerConfig = new DocumentBuilder()
.setTitle('SwordBattle.io Api')
.setDescription('The SwordBattle.io API Documentation')
.setVersion('1.0')
.build();
const document = SwaggerModule.createDocument(app, swaggerConfig);
SwaggerModule.setup('api', app, document);

app.use(cookieParser(config.appSecret));
app.enableCors({
Expand Down

0 comments on commit 578a1e8

Please sign in to comment.