From 85631931f9ad4bf8f62d2a063939928ec1fe839f Mon Sep 17 00:00:00 2001 From: salvacybersec Date: Tue, 11 Nov 2025 06:16:38 +0300 Subject: [PATCH] Fix: Move frontendDistPath definition before usage --- backend/src/app.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/src/app.js b/backend/src/app.js index 22123fe..ad72cbe 100644 --- a/backend/src/app.js +++ b/backend/src/app.js @@ -125,17 +125,17 @@ app.updateCorsSettings = updateCorsFromSettings; app.use(express.json()); app.use(express.urlencoded({ extended: true })); +// Serve frontend build files (if exists, for production) +const path = require('path'); +const frontendDistPath = path.join(__dirname, '../../frontend/dist'); +const fs = require('fs'); + // Serve static files (landing page) - but only for specific paths // Don't serve from public if frontend dist exists (to avoid conflicts) if (!fs.existsSync(frontendDistPath)) { app.use(express.static('src/public')); } -// Serve frontend build files (if exists, for production) -const path = require('path'); -const frontendDistPath = path.join(__dirname, '../../frontend/dist'); -const fs = require('fs'); - if (fs.existsSync(frontendDistPath)) { logger.info(`Frontend dist found at: ${frontendDistPath}`);