diff --git a/client/src/config.ts b/client/src/config.ts index a794e21e22ce31dfe62034bf3299d55bdc7f31fb..a54e8256377cc0d8818c4bd5a1f5c4305ddd50ab 100644 --- a/client/src/config.ts +++ b/client/src/config.ts @@ -1,8 +1,8 @@ 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`; } diff --git a/server/src/index.ts b/server/src/index.ts index d9ea92232ddf28b66fcd5a8ce09919442be093a7..556f574a4f2d8ce98ca20f3e886b5161dd517339 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -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); diff --git a/server/src/v1/project.ts b/server/src/v1/project.ts index e592264cd8cdca0cefa3a8ecccc6a59757e5300e..600a7170aa296854d32a92418ad5d1b39973ca1f 100644 --- a/server/src/v1/project.ts +++ b/server/src/v1/project.ts @@ -270,7 +270,6 @@ project.get('/:uuid/activity', async (req, res) => { }); } } catch (e) { - console.log(e); res.status(400).json({ status: 'error', message: 'failed get activity', @@ -328,7 +327,6 @@ project.get('/:uuid/completion', async (req, res) => { }); } } catch (e) { - console.log(e); res.status(400).json({ status: 'error', message: 'failed get completion',