Skip to content

Commit a846a31

Browse files
committed
test
1 parent a8480ec commit a846a31

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

server/server.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,23 @@ app.use("/api/daily-settings", dailySettingsRoutes);
8080
// Serve static files only in production
8181
if (isProduction) {
8282
const clientPath = path.resolve(__dirname, "../client/dist");
83-
app.use(express.static(clientPath));
83+
app.use(
84+
express.static(clientPath, {
85+
maxAge: "1d", // Cache static files for 1 day
86+
})
87+
);
8488

8589
app.get("*", (req, res) => {
86-
res.sendFile(path.join(clientPath, "index.html"));
90+
res.sendFile(path.join(clientPath, "index.html"), {
91+
headers: { "Cache-Control": "no-cache" }, // Prevent caching of index.html
92+
});
8793
});
8894
}
8995

96+
app.get("/test", (req, res) => {
97+
res.sendFile(path.join(__dirname, "public", "index.html"));
98+
});
99+
90100
// Socket.IO event listeners
91101
io.on("connection", (socket) => {
92102
socket.on("joinRoom", (roomId) => {

0 commit comments

Comments
 (0)