Fix: Express v5 wildcard route, add global error handlers

This commit is contained in:
Claude Code 2026-03-05 11:30:21 +01:00
parent f043ff97bb
commit 5c45c098e2

View file

@ -1530,11 +1530,19 @@ app.post('/api/play-url', async (req: Request, res: Response) => {
const webDistPath = path.resolve(__dirname, '../../web/dist');
if (fs.existsSync(webDistPath)) {
app.use(express.static(webDistPath));
app.get('*', (_req, res) => {
app.get('/{*splat}', (_req, res) => {
res.sendFile(path.join(webDistPath, 'index.html'));
});
}
process.on('uncaughtException', (err) => {
console.error(`FATAL uncaughtException:`, err);
process.exit(1);
});
process.on('unhandledRejection', (reason) => {
console.error(`FATAL unhandledRejection:`, reason);
});
app.listen(PORT, () => {
console.log(`Server läuft auf http://0.0.0.0:${PORT}`);