Skip to content

Commit e9fffbf

Browse files
fix: swagger production 환경에서는 비활성화
1 parent 4804ab2 commit e9fffbf

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

apps/backend/src/main.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ async function bootstrap() {
1717
app.setGlobalPrefix('api');
1818
app.use(express.urlencoded({ extended: true }));
1919

20-
const config = new DocumentBuilder()
21-
.setTitle('OctoDocs')
22-
.setDescription('OctoDocs API 명세서')
23-
.build();
20+
// Swagger 설정 (production 환경에서는 비활성화)
21+
if (process.env.NODE_ENV !== 'production') {
22+
const config = new DocumentBuilder()
23+
.setTitle('OctoDocs')
24+
.setDescription('OctoDocs API 명세서')
25+
.build();
26+
27+
const documentFactory = () => SwaggerModule.createDocument(app, config);
28+
SwaggerModule.setup('api', app, documentFactory);
29+
}
2430

25-
const documentFactory = () => SwaggerModule.createDocument(app, config);
26-
SwaggerModule.setup('api', app, documentFactory);
2731
app.enableCors({
2832
origin:
2933
process.env.NODE_ENV === 'production'

0 commit comments

Comments
 (0)