mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-12 15:16:37 +00:00
move console api call into console
This commit is contained in:
parent
46fd27842a
commit
12df580267
@ -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;
|
||||
|
@ -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") +
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user