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

Merge branch 'deployment' into devel

parents 676a3b18 4a49ae42
No related branches found
No related tags found
No related merge requests found
export let apiRoot: string; export let apiRoot: string;
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
apiRoot = `${window.location.origin}/v1`; apiRoot = `${window.location.origin}/api/v1`;
} else { } else {
apiRoot = `http://localhost:8000/v1`; apiRoot = `http://localhost:8000/api/v1`;
} }
...@@ -9,11 +9,15 @@ migrate(); ...@@ -9,11 +9,15 @@ migrate();
const app = express(); const app = express();
app.use('/api', api);
if (web_serve) { if (web_serve) {
app.use('/', express.static(web_serve)); app.use('/', express.static(web_serve));
}
app.use(api); app.get('/', (_, res) => {
res.sendFile('index.html', { root: web_serve });
});
}
app.listen(port); app.listen(port);
...@@ -270,7 +270,6 @@ project.get('/:uuid/activity', async (req, res) => { ...@@ -270,7 +270,6 @@ project.get('/:uuid/activity', async (req, res) => {
}); });
} }
} catch (e) { } catch (e) {
console.log(e);
res.status(400).json({ res.status(400).json({
status: 'error', status: 'error',
message: 'failed get activity', message: 'failed get activity',
...@@ -328,7 +327,6 @@ project.get('/:uuid/completion', async (req, res) => { ...@@ -328,7 +327,6 @@ project.get('/:uuid/completion', async (req, res) => {
}); });
} }
} catch (e) { } catch (e) {
console.log(e);
res.status(400).json({ res.status(400).json({
status: 'error', status: 'error',
message: 'failed get completion', message: 'failed get completion',
......
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