diff --git a/admin/server.js b/admin/server.js index df7a0ab..26dd8e5 100644 --- a/admin/server.js +++ b/admin/server.js @@ -153,8 +153,12 @@ app.post('/api/admin/cancel-game', async (req, res) => { } }); -// Serve static files from current directory (AFTER API routes) +// Configure MIME types for modules +express.static.mime.define({'application/javascript': ['js', 'mjs']}); + +// Serve static files from current directory and dist (AFTER API routes) app.use(express.static('.')); +app.use(express.static('dist')); // Serve main HTML file for SPA routes app.get('*', (req, res) => { diff --git a/client/server.js b/client/server.js index e242401..62b7688 100644 --- a/client/server.js +++ b/client/server.js @@ -9,8 +9,12 @@ dotenv.config({ path: `.env.${ENV}` }); const app = express(); const PORT = process.env.PORT || 3000; -// Serve static files from current directory +// Configure MIME types for modules +express.static.mime.define({'application/javascript': ['js', 'mjs']}); + +// Serve static files from current directory and dist app.use(express.static('.')); +app.use(express.static('dist')); // Serve main HTML file app.get('/', (req, res) => { diff --git a/docker-compose.yml b/docker-compose.yml index 5694b23..1f456db 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: environment: - NODE_ENV=production - PORT=3000 - - VITE_SERVER_URL=http://snatchgame-server:2567 + - SERVER_URL=http://snatchgame-server:2567 depends_on: - snatchgame-server networks: @@ -51,7 +51,7 @@ services: environment: - NODE_ENV=production - PORT=3001 - - VITE_SERVER_URL=http://snatchgame-server:2567 + - SERVER_URL=http://snatchgame-server:2567 depends_on: - snatchgame-server networks: