Skip to content

Commit

Permalink
Merge pull request #252 from porters-xyz/add-oai-specs
Browse files Browse the repository at this point in the history
added swagger module
  • Loading branch information
wtfsayo authored May 15, 2024
2 parents 5bc07e4 + 8f5e33f commit 640f847
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions web-portal/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/schedule": "^4.0.2",
"@nestjs/swagger": "^7.3.1",
"@prisma/client": "^5.9.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
Expand Down
12 changes: 9 additions & 3 deletions web-portal/backend/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { HttpAdapterHost, NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { PrismaClientExceptionFilter } from 'nestjs-prisma';
import { AppModule } from './app.module';
import * as cookieParser from 'cookie-parser';
Expand All @@ -8,9 +9,14 @@ async function bootstrap() {
// const { httpAdapter } = app.get(HttpAdapterHost);
// app.useGlobalFilters(new PrismaClientExceptionFilter(httpAdapter));

// Remove CORS in prod

app.enableCors();
const config = new DocumentBuilder()
.setTitle('Gateway Web-Portal Backend')
.setDescription('Backend APIs')
.setVersion('1.0')
.addTag('specs')
.build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('specs', app, document);

app.use(cookieParser());

Expand Down

0 comments on commit 640f847

Please sign in to comment.