poprawki dla dev

This commit is contained in:
2025-07-21 00:58:17 +02:00
parent 93232a1663
commit 9777b46777
2 changed files with 13 additions and 11 deletions

View File

@@ -34,7 +34,7 @@ class WebPanel {
this.app.use(cors({
origin: process.env.NODE_ENV === 'production'
? ['https://your-domain.com']
: ['http://localhost:3001', 'http://127.0.0.1:3001'],
: ['http://localhost:3001', 'http://127.0.0.1:3001', 'http://localhost:3000'],
credentials: true
}));
@@ -44,8 +44,10 @@ class WebPanel {
this.app.use(express.json({ limit: '10mb' }));
this.app.use(express.urlencoded({ extended: true, limit: '10mb' }));
// Serwowanie plików statycznych (dla built React app)
this.app.use(express.static('frontend/build'));
// Serwowanie plików statycznych tylko w production
if (process.env.NODE_ENV === 'production') {
this.app.use(express.static('frontend/build'));
}
}
setupRoutes() {
@@ -63,10 +65,12 @@ class WebPanel {
});
});
// Catch all handler dla React Router
this.app.get('*', (req, res) => {
res.sendFile('index.html', { root: 'frontend/build' });
});
// Catch all handler dla React Router - tylko w production
if (process.env.NODE_ENV === 'production') {
this.app.get('*', (req, res) => {
res.sendFile('index.html', { root: 'frontend/build' });
});
}
// Error handler
this.app.use(this.errorHandler.bind(this));

View File

@@ -69,9 +69,7 @@ services:
API_PORT: 3000
# OAuth2
OAUTH2_REDIRECT_URI: http://localhost:3001/auth/discord/callback
# Environment
OAUTH2_REDIRECT_URI: http://localhost:3001/auth/discord/callback # Environment
NODE_ENV: development
LOG_LEVEL: debug