mirror of https://github.com/embarklabs/embark.git
rebase fixes
This commit is contained in:
parent
2843303d8c
commit
b12856fe2d
|
@ -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;
|
||||||
|
|
|
@ -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([
|
||||||
|
|
Loading…
Reference in New Issue