Skip to content
Snippets Groups Projects
Commit 4a49ae42 authored by Bernard Roland (Student Com20)'s avatar Bernard Roland (Student Com20)
Browse files

index.html is now served as default for non-/api requests

parent eb719bea
No related branches found
No related tags found
No related merge requests found
export let apiRoot: string;
if (process.env.NODE_ENV === 'production') {
apiRoot = `${window.location.origin}/v1`;
apiRoot = `${window.location.origin}/api/v1`;
} else {
apiRoot = `http://localhost:8000/v1`;
apiRoot = `http://localhost:8000/api/v1`;
}
......@@ -9,11 +9,15 @@ migrate();
const app = express();
app.use('/api', api);
if (web_serve) {
app.use('/', express.static(web_serve));
}
app.use(api);
app.get('/', (_, res) => {
res.sendFile('index.html', { root: web_serve });
});
}
app.listen(port);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment