Fix race condition

This commit is contained in:
Anthony Laibe 2018-10-01 10:10:17 +01:00 committed by Pascal Precht
parent 0e87d21b12
commit feb59655cc
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 4 additions and 5 deletions

View File

@ -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;

View File

@ -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);