From 5f469f37d1fca5a622acd7b0d6845f1dd2545ecd Mon Sep 17 00:00:00 2001 From: Paul Soares Date: Tue, 31 Dec 2024 11:30:17 +0100 Subject: [PATCH] Update main.ts Set global prefix before swagger document creation to allow for correct path (including api prefix) --- apps/api/src/main.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index 8f30867..7bd0d9b 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -11,13 +11,14 @@ async function bootstrap() { .setTitle('@boldare/openai-assistant') .setVersion('1.2.1') .build(); - const document = SwaggerModule.createDocument(app, config); - - SwaggerModule.setup('api/docs', app, document); - + app.setGlobalPrefix(globalPrefix); app.enableCors(cors); + + const document = SwaggerModule.createDocument(app, config); + + SwaggerModule.setup('api/docs', app, document); const port = process.env['PORT'] || 3000; await app.listen(port);