move console api call into console

This commit is contained in:
Iuri Matias 2018-03-13 06:46:58 -04:00
parent 46fd27842a
commit 12df580267
3 changed files with 6 additions and 4 deletions

View File

@ -2,6 +2,7 @@ let utils = require('../../lib/utils/utils.js');
class Console {
constructor(options) {
const self = this;
this.events = options.events;
this.plugins = options.plugins;
this.version = options.version;

View File

@ -6,6 +6,7 @@ require('http-shutdown').extend();
var express = require('express');
let path = require('path');
var expressWebSocket = require('express-ws');
var bodyParser = require('body-parser');
class Server {
constructor(options) {
@ -30,6 +31,9 @@ class Server {
app.use(serve);
app.use('/embark', serveStatic(path.join(__dirname, 'backend'), {'backend': ['index.html', 'index.htm']}));
app.use(bodyParser.json()); // support json encoded bodies
app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies
expressWebSocket(app);
app.ws('/embark/logs', function(ws, req) {
@ -47,10 +51,6 @@ class Server {
res.send('Welcome to Embark')
});
app.get('/embark/console', function (req, res) {
self.events.request('console:command', req.query.cmd, res.send.bind(res));
});
app.listen(this.port);
let message = __("webserver available at") +

View File

@ -33,6 +33,7 @@
"bip39": "^2.5.0",
"chokidar": "^2.0.3",
"clone-deep": "^4.0.0",
"body-parser": "^1.18.2",
"colors": "^1.1.2",
"commander": "^2.15.1",
"css-loader": "^0.28.11",