diff --git a/server/src/app.ts b/server/src/app.ts index 87341a5..da4a63d 100644 --- a/server/src/app.ts +++ b/server/src/app.ts @@ -16,7 +16,7 @@ if (env.client.serve) { if (fs.existsSync(clientDistPath) && fs.existsSync(indexHtmlPath)) { app.use(express.static(clientDistPath)); - const spaHandler = (req: express.Request, res: express.Response, next: express.NextFunction) => { + app.use((req, res, next) => { if (req.method !== 'GET' && req.method !== 'HEAD') { return next(); } @@ -34,10 +34,7 @@ if (env.client.serve) { } return res.sendFile(indexHtmlPath); - }; - - app.get('/*', spaHandler); - app.head('/*', spaHandler); + }); } else { console.warn( `Static client assets not served because the build output was not found at "${clientDistPath}".`