diff --git a/lib/modules/webserver/index.js b/lib/modules/webserver/index.js index c9de286b..7d8d383f 100644 --- a/lib/modules/webserver/index.js +++ b/lib/modules/webserver/index.js @@ -39,6 +39,9 @@ class WebServer { openBrowser: this.webServerConfig.openBrowser }); + this.listenToCommands(); + this.registerConsoleCommands(); + this.events.on('webserver:config:change', () => { this.embark.config.webServerConfig = null; this.embark.config.loadWebServerConfigFile(); @@ -60,8 +63,6 @@ class WebServer { }); this.testPort(() => { - this.listenToCommands(); - this.registerConsoleCommands(); this.server.start((_err, message, port) => { this.logger.info(message); this.port = port; diff --git a/lib/modules/webserver/server.js b/lib/modules/webserver/server.js index b850b361..e3fafb62 100644 --- a/lib/modules/webserver/server.js +++ b/lib/modules/webserver/server.js @@ -54,8 +54,6 @@ class Server { const main = serveStatic(this.buildDir, {'index': ['index.html', 'index.htm']}); this.app = express(); - const expressWs = expressWebSocket(this.app); - // Assign Logging Function this.app.use(function(req, res, next) { if (self.logging) { @@ -65,8 +63,8 @@ class Server { } next(); }); - this.app.use(main); this.app.use(cors()); + this.app.use(main); this.app.use('/coverage', coverage); this.app.use(coverageStyle);