strip off ui from path in server lite

This commit is contained in:
Nour Alharithi
2023-12-14 18:19:31 -08:00
parent 7427c0cdf8
commit 1e9e3caccc

View File

@@ -99,6 +99,17 @@ app.use((req, _res, next) => {
next();
});
// strip off /ui, if the request comes from the UI
app.use((req, _res, next) => {
if (req.url.startsWith('/ui')) {
req.url = req.url.replace('/ui', '');
if (req.url === '') {
req.url = '/';
}
}
next();
});
app.use(errorHandler);
const server = http.createServer(app);