aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.env.template2
-rw-r--r--api/routes/application.js37
2 files changed, 9 insertions, 30 deletions
diff --git a/.env.template b/.env.template
index b6fe7dc..c1a5efd 100644
--- a/.env.template
+++ b/.env.template
@@ -3,4 +3,4 @@ GITHUB_APP_NAME=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_OAUTH_CALLBACK_URL=
-APP_BASE_URL= \ No newline at end of file
+APP_BASE_URL=http://localhost:3000 \ No newline at end of file
diff --git a/api/routes/application.js b/api/routes/application.js
index add60be..7a786a8 100644
--- a/api/routes/application.js
+++ b/api/routes/application.js
@@ -1,52 +1,31 @@
const childProcess = require('child_process')
const path = require('path')
-const express = require('express')
-const expressWs = require('express-ws')
const config = require('../config')
-const appDir = path.join(__dirname, '..', '..', 'application')
+const appDir = path.join(__dirname, '..', '..', 'app')
+const API_BASE_URL = 'http://localhost:8080'
+const APP_BASE_URL = 'http://localhost:3000'
function init (app) {
- expressWs(app)
-
const opts = {
cwd: appDir,
env: Object.assign({}, process.env, {
ENABLE_LOCAL: true,
ENABLE_GITHUB: config.ENABLE_GITHUB,
GITHUB_APP_NAME: config.GITHUB_APP_NAME,
- API_BASE_URL: 'http://localhost:8080',
- APP_BASE_URL: 'http://localhost:8080/application'
+ API_BASE_URL,
+ APP_BASE_URL
})
}
- childProcess.execFile('npm', ['run', 'build-watch'], opts, err => {
+ childProcess.execFile('npm', ['start'], opts, err => {
console.error(err)
console.error('Application serving failed')
process.exit(1)
})
-
- app.get('/', (req, res) => res.redirect('/application'))
- app.use('/application', express.static(path.join(appDir, 'dist')))
-
- const subscribers = []
- app.ws('/console', (ws, req) => {
- const { remoteAddress } = req.connection
- subscribers.push(ws)
-
- console.info(`[${new Date()}] [${remoteAddress}] connected`)
-
- ws.onerror = err => {
- console.error(`[${new Date()}] [${remoteAddress}]`, err)
- }
-
- ws.onclose = () => {
- console.info(`[${new Date()}] [${remoteAddress}] disconnected`)
- const index = subscribers.indexOf(ws)
- subscribers.splice(index, 1)
- }
- })
+
+ app.get('/', (req, res) => res.redirect(APP_BASE_URL))
}
module.exports = init