mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-15 09:45:47 +00:00
cherry-pick features/react-routes
This commit is contained in:
parent
4e30ddeb1b
commit
50740211da
@ -387,7 +387,8 @@ Config.prototype.loadWebServerConfigFile = function() {
|
|||||||
"enabled": true,
|
"enabled": true,
|
||||||
"host": defaultHost,
|
"host": defaultHost,
|
||||||
"openBrowser": true,
|
"openBrowser": true,
|
||||||
"port": 8000
|
"port": 8000,
|
||||||
|
"enableCatchAll": true
|
||||||
};
|
};
|
||||||
|
|
||||||
let configFilePath = this._getFileOrOject(this.configDir, 'webserver', 'webserver');
|
let configFilePath = this._getFileOrOject(this.configDir, 'webserver', 'webserver');
|
||||||
|
@ -23,6 +23,7 @@ class WebServer {
|
|||||||
|
|
||||||
this.host = this.webServerConfig.host;
|
this.host = this.webServerConfig.host;
|
||||||
this.port = parseInt(this.webServerConfig.port, 10);
|
this.port = parseInt(this.webServerConfig.port, 10);
|
||||||
|
this.enableCatchAll = this.webServerConfig.enableCatchAll === true;
|
||||||
|
|
||||||
this.events.emit("status", __("Starting Server"));
|
this.events.emit("status", __("Starting Server"));
|
||||||
|
|
||||||
|
@ -77,12 +77,13 @@ class Server {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let apiCalls = self.plugins.getPluginsProperty("apiCalls", "apiCalls");
|
if (self.plugins) {
|
||||||
console.dir(apiCalls);
|
let apiCalls = self.plugins.getPluginsProperty("apiCalls", "apiCalls");
|
||||||
for (let apiCall of apiCalls) {
|
for (let apiCall of apiCalls) {
|
||||||
console.dir("adding " + apiCall.method + " " + apiCall.endpoint);
|
console.dir("adding " + apiCall.method + " " + apiCall.endpoint);
|
||||||
app[apiCall.method].apply(app, [apiCall.endpoint, apiCall.cb]);
|
app[apiCall.method].apply(app, [apiCall.endpoint, apiCall.cb]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.app.ws('/', function(ws, _req) {
|
this.app.ws('/', function(ws, _req) {
|
||||||
self.events.on('outputDone', () => {
|
self.events.on('outputDone', () => {
|
||||||
@ -97,6 +98,13 @@ class Server {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.enableCatchAll === true) {
|
||||||
|
app.get('/*', function (req, res) {
|
||||||
|
self.logger.trace('webserver> GET ' + req.path);
|
||||||
|
res.sendFile(path.join(fs.dappPath(self.dist, 'index.html')));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function createPlaceholderPage(next) {
|
function createPlaceholderPage(next) {
|
||||||
if (!self.isFirstStart) {
|
if (!self.isFirstStart) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user