Fix: Express v5 wildcard route, add global error handlers
This commit is contained in:
parent
f043ff97bb
commit
5c45c098e2
1 changed files with 9 additions and 1 deletions
|
|
@ -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}`);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue