Fix: Move frontendDistPath definition before usage

This commit is contained in:
salvacybersec
2025-11-11 06:16:38 +03:00
parent 859a656032
commit 85631931f9

View File

@@ -125,17 +125,17 @@ app.updateCorsSettings = updateCorsFromSettings;
app.use(express.json()); app.use(express.json());
app.use(express.urlencoded({ extended: true })); 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 // Serve static files (landing page) - but only for specific paths
// Don't serve from public if frontend dist exists (to avoid conflicts) // Don't serve from public if frontend dist exists (to avoid conflicts)
if (!fs.existsSync(frontendDistPath)) { if (!fs.existsSync(frontendDistPath)) {
app.use(express.static('src/public')); 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)) { if (fs.existsSync(frontendDistPath)) {
logger.info(`Frontend dist found at: ${frontendDistPath}`); logger.info(`Frontend dist found at: ${frontendDistPath}`);