diff --git a/drills/flat-stack-presejpacky/server.ts b/drills/flat-stack-presejpacky/server.ts index 17e2ee5..30acdc1 100644 --- a/drills/flat-stack-presejpacky/server.ts +++ b/drills/flat-stack-presejpacky/server.ts @@ -30,8 +30,15 @@ app.use((req, res, next) => { next(); }); -// Serve static files from the 'dist' directory -app.use(express.static(path.join(__dirname, 'dist'))); +// Serve static files from the 'dist' directory, but bypass index.html requests +// so they can be handled dynamically by our fallback route. +app.use((req, res, next) => { + if (req.url === '/index.html') { + return next(); + } + next(); +}); +app.use(express.static(path.join(__dirname, 'dist'), { index: false })); // Fallback to index.html for Single Page Application routing, injecting base path from headers app.get('*', (req, res) => {