WEB UI microservice: fallback to index.html for non-existent resource.

This commit is contained in:
Igor Kulikov 2024-09-12 13:23:57 +03:00
parent b49bf05e45
commit 9eee7634c4

View File

@ -99,7 +99,12 @@ let connections: Socket[] = [];
const root = path.join(webDir, 'public');
app.use(express.static(root));
const staticServe = express.static(root);
app.use(staticServe);
app.use((req, res, next) => {
res.sendFile(path.join(root, 'index.html'));
});
server.listen(bindPort, bindAddress, () => {
logger.info('==> 🌎 Listening on port %s.', bindPort);