fix: add catch-all route to serve frontend index.html (#14)

Co-authored-by: samanhappy@qq.com <my6051199>
This commit is contained in:
samanhappy
2025-04-18 15:00:52 +08:00
committed by GitHub
parent 7feb5b2bcb
commit f477e1f942

View File

@@ -1,5 +1,6 @@
import express from 'express';
import { check } from 'express-validator';
import path from 'path';
import {
getAllServers,
getAllSettings,
@@ -71,6 +72,10 @@ export const initRoutes = (app: express.Application): void => {
], changePassword);
app.use('/api', router);
app.get('*', (_req, res) => {
res.sendFile(path.join(process.cwd(), 'frontend', 'dist', 'index.html'));
});
};
export default router;