rebase fixes

This commit is contained in:
Iuri Matias 2018-09-30 18:56:33 -04:00 committed by Pascal Precht
parent 2843303d8c
commit b12856fe2d
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 5 additions and 7 deletions

View File

@ -10,7 +10,7 @@ const Templates = {
}; };
class WebServer { class WebServer {
constructor(embark) { constructor(embark, options) {
this.embark = embark; this.embark = embark;
this.logger = embark.logger; this.logger = embark.logger;
this.events = embark.events; this.events = embark.events;

View File

@ -5,12 +5,9 @@ const expressWebSocket = require('express-ws');
const express = require('express'); const express = require('express');
const fs = require('../../core/fs'); const fs = require('../../core/fs');
require('http-shutdown').extend(); require('http-shutdown').extend();
var express = require('express');
var cors = require('cors'); var cors = require('cors');
let path = require('path'); let path = require('path');
var expressWebSocket = require('express-ws');
var bodyParser = require('body-parser'); var bodyParser = require('body-parser');
var fs = require('../../core/fs.js');
class Server { class Server {
constructor(options) { constructor(options) {
@ -18,6 +15,7 @@ class Server {
this.buildDir = options.buildDir; this.buildDir = options.buildDir;
this.events = options.events; this.events = options.events;
this.port = options.port || 8000; this.port = options.port || 8000;
this.dist = options.dist || 'dist/';
this.hostname = dockerHostSwap(options.host) || defaultHost; this.hostname = dockerHostSwap(options.host) || defaultHost;
this.isFirstStart = true; this.isFirstStart = true;
this.opened = false; this.opened = false;
@ -75,8 +73,8 @@ class Server {
this.app.use(express.static(path.join(fs.dappPath(this.dist)), {'index': ['index.html', 'index.htm']})); this.app.use(express.static(path.join(fs.dappPath(this.dist)), {'index': ['index.html', 'index.htm']}));
this.app.use('/embark', express.static(path.join(__dirname, '../../../embark-ui/build'))); this.app.use('/embark', express.static(path.join(__dirname, '../../../embark-ui/build')));
app.use(bodyParser.json()); // support json encoded bodies this.app.use(bodyParser.json()); // support json encoded bodies
app.use(bodyParser.urlencoded({extended: true})); // support encoded bodies this.app.use(bodyParser.urlencoded({extended: true})); // support encoded bodies
expressWebSocket(this.app); expressWebSocket(this.app);
@ -128,7 +126,7 @@ class Server {
this.app.get('/*', function (req, res) { this.app.get('/*', function (req, res) {
self.logger.trace('webserver> GET ' + req.path); self.logger.trace('webserver> GET ' + req.path);
res.sendFile(path.join(fs.dappPath(self.dist, 'index.html'))); res.sendFile(path.join(fs.dappPath(self.dist, 'index.html')));
} });
} }
async.waterfall([ async.waterfall([