From 7303d1ea0b1b38f69cabbffdfbd80aba0bf88186 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Thu, 22 Jan 2026 13:40:03 +0100 Subject: [PATCH] Implement request handling for 3D models in app.js - Added middleware to prevent direct access to /models/ paths, directing users to use /api/models/ instead for optimized 3D models. - Updated comments to clarify the purpose of the new middleware and its role in serving models through the API. --- backend/app.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/app.js b/backend/app.js index 8d86d4e..63ec283 100644 --- a/backend/app.js +++ b/backend/app.js @@ -80,7 +80,14 @@ app.use('/api/blog', blogRouter); app.use('/api/termine', termineRouter); // Serve frontend SPA for non-API routes to support history mode clean URLs +// /models/* nicht statisch ausliefern – nur über /api/models (Proxy mit Komprimierung) const frontendDir = path.join(__dirname, '../frontend'); +app.use((req, res, next) => { + if (req.path.startsWith('/models/')) { + return res.status(404).send('Use /api/models/ for 3D models (optimized).'); + } + next(); +}); app.use(express.static(path.join(frontendDir, 'dist'))); app.get(/^\/(?!api\/).*/, (req, res) => { res.sendFile(path.join(frontendDir, 'dist', 'index.html'));