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

View File

@@ -67,11 +67,9 @@ services:
SESSION_SECRET: dev_session_secret_key SESSION_SECRET: dev_session_secret_key
WEB_PORT: 3001 WEB_PORT: 3001
API_PORT: 3000 API_PORT: 3000
# OAuth2 # OAuth2
OAUTH2_REDIRECT_URI: http://localhost:3001/auth/discord/callback OAUTH2_REDIRECT_URI: http://localhost:3001/auth/discord/callback # Environment
# Environment
NODE_ENV: development NODE_ENV: development
LOG_LEVEL: debug LOG_LEVEL: debug