Spaces:
Sleeping
Sleeping
Commit
·
b92158e
1
Parent(s):
55a6cd7
fix(docker): use regex instead of require('path') for extension check
Browse filesUse regex /\.[a-zA-Z0-9]+$/ to detect file extensions in SPA catch-all
route, avoiding ESM/CommonJS compatibility issues with require().
Co-Authored-By: Claude <noreply@anthropic.com>
- Dockerfile +1 -1
Dockerfile
CHANGED
|
@@ -38,7 +38,7 @@ app.use(cors()); \
|
|
| 38 |
app.use(express.json()); \
|
| 39 |
app.use(express.static("app/dist")); \
|
| 40 |
app.get("/health", (req, res) => res.json({status: "ok", timestamp: new Date().toISOString()})); \
|
| 41 |
-
app.get("*", (req, res, next) => { if (req.path.startsWith("/health") || req.path.startsWith("/socket.io")) return next();
|
| 42 |
io.on("connection", (socket) => { console.log("Client connected:", socket.id); setupSocketHandlers(io, socket, gameManager); socket.on("disconnect", () => console.log("Client disconnected:", socket.id)); }); \
|
| 43 |
httpServer.listen(PORT, "0.0.0.0", () => console.log("Server running on port " + PORT));' > docker-entry.ts
|
| 44 |
|
|
|
|
| 38 |
app.use(express.json()); \
|
| 39 |
app.use(express.static("app/dist")); \
|
| 40 |
app.get("/health", (req, res) => res.json({status: "ok", timestamp: new Date().toISOString()})); \
|
| 41 |
+
app.get("*", (req, res, next) => { if (req.path.startsWith("/health") || req.path.startsWith("/socket.io")) return next(); if (/\\.[a-zA-Z0-9]+$/.test(req.path)) return next(); res.sendFile("app/dist/index.html", {root: "/app"}); }); \
|
| 42 |
io.on("connection", (socket) => { console.log("Client connected:", socket.id); setupSocketHandlers(io, socket, gameManager); socket.on("disconnect", () => console.log("Client disconnected:", socket.id)); }); \
|
| 43 |
httpServer.listen(PORT, "0.0.0.0", () => console.log("Server running on port " + PORT));' > docker-entry.ts
|
| 44 |
|