This commit is contained in:
@@ -245,18 +245,15 @@ app.post('/publish/:topic', authenticateApiKey, (req, res) => {
|
||||
|
||||
// Start servers
|
||||
const WS_PORT = process.env.WS_PORT || 3000;
|
||||
const API_PORT = process.env.API_PORT || 8080;
|
||||
const API_PORT = process.env.WS_PORT || 3000; // Use same port for both
|
||||
|
||||
// Start WebSocket server
|
||||
io.listen(WS_PORT);
|
||||
console.log(`WebSocket server running on port ${WS_PORT}`);
|
||||
|
||||
// Start HTTP API server
|
||||
app.listen(API_PORT, () => {
|
||||
console.log(`HTTP API server running on port ${API_PORT}`);
|
||||
// Start HTTP API server (Socket.IO will be served on the same port)
|
||||
server.listen(API_PORT, () => {
|
||||
console.log(`HTTP API and WebSocket server running on port ${API_PORT}`);
|
||||
console.log(`Health check: http://localhost:${API_PORT}/health`);
|
||||
console.log(`Topics: http://localhost:${API_PORT}/topics`);
|
||||
console.log(`Publish: POST http://localhost:${API_PORT}/publish`);
|
||||
console.log(`WebSocket connections: ws://localhost:${API_PORT}`);
|
||||
console.log(`API Key configured: ${API_KEY !== 'default-api-key-change-me' ? 'Yes' : 'No (using default)'}`);
|
||||
if (API_KEY === 'default-api-key-change-me') {
|
||||
console.log(`⚠️ WARNING: Using default API key. Set API_KEY environment variable for production!`);
|
||||
|
||||
Reference in New Issue
Block a user