backend/src/index.js aktualisiert
This commit is contained in:
@@ -28,6 +28,16 @@ fs.readdirSync(toolsDir, { withFileTypes: true })
|
|||||||
|
|
||||||
// ── React-Frontend ausliefern ─────────────────────────────────────────────────
|
// ── React-Frontend ausliefern ─────────────────────────────────────────────────
|
||||||
const PUBLIC = path.join(__dirname, '../public');
|
const PUBLIC = path.join(__dirname, '../public');
|
||||||
|
|
||||||
|
// Service Worker braucht diesen Header damit er auf '/' zugreifen darf
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
if (req.path === '/sw.js') {
|
||||||
|
res.setHeader('Service-Worker-Allowed', '/');
|
||||||
|
res.setHeader('Cache-Control', 'no-cache');
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
app.use(express.static(PUBLIC));
|
app.use(express.static(PUBLIC));
|
||||||
app.get('*', (_req, res) => res.sendFile(path.join(PUBLIC, 'index.html')));
|
app.get('*', (_req, res) => res.sendFile(path.join(PUBLIC, 'index.html')));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user