poprawki dla dev
This commit is contained in:
@@ -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,9 +44,11 @@ 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
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
this.app.use(express.static('frontend/build'));
|
this.app.use(express.static('frontend/build'));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setupRoutes() {
|
setupRoutes() {
|
||||||
// API Routes
|
// API Routes
|
||||||
@@ -63,10 +65,12 @@ class WebPanel {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Catch all handler dla React Router
|
// Catch all handler dla React Router - tylko w production
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
this.app.get('*', (req, res) => {
|
this.app.get('*', (req, res) => {
|
||||||
res.sendFile('index.html', { root: 'frontend/build' });
|
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));
|
||||||
|
|||||||
@@ -69,9 +69,7 @@ services:
|
|||||||
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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user