From eba861b38df7fe674a3fc61dfe1682129b1c6947 Mon Sep 17 00:00:00 2001 From: ihab4real Date: Fri, 6 Jun 2025 05:47:51 +0300 Subject: [PATCH] fix(server/config): replace hardcoded localhost URL in logs Use environment-aware URL for API documentation console logs to correctly display production URL when running in production environments. Closes #32 --- server/config/swagger.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/config/swagger.js b/server/config/swagger.js index 36598e2..f3e439b 100644 --- a/server/config/swagger.js +++ b/server/config/swagger.js @@ -16,7 +16,7 @@ const options = { { url: process.env.NODE_ENV === "production" - ? "https://api.flowfocus.com" // Update this with your production URL + ? "https://api.flowfocus.bestoneclinic.com" : `http://localhost:${process.env.PORT || 3000}`, description: process.env.NODE_ENV === "production" @@ -281,7 +281,11 @@ export const swaggerDocs = (app, port) => { res.send(specs); }); - console.log( - `📚 API Documentation available at http://localhost:${port}/docs` - ); + // Get the base URL from the same configuration used in the Swagger options + const baseUrl = + process.env.NODE_ENV === "production" + ? "https://api.flowfocus.bestoneclinic.com" // TODO: host this in the future + : `http://localhost:${port}`; + + console.log(`📚 API Documentation available at ${baseUrl}/docs`); };