File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -80,13 +80,23 @@ app.use("/api/daily-settings", dailySettingsRoutes);
8080// Serve static files only in production
8181if ( 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
91101io . on ( "connection" , ( socket ) => {
92102 socket . on ( "joinRoom" , ( roomId ) => {
You can’t perform that action at this time.
0 commit comments