diff --git a/lib/modules/console/index.js b/lib/modules/console/index.js index 0cf40668..1c21a04b 100644 --- a/lib/modules/console/index.js +++ b/lib/modules/console/index.js @@ -24,6 +24,16 @@ class Console { this.events.setCommandHandler("console:history", (cb) => this.getHistory(process.env.DEFAULT_CMD_HISTORY_SIZE, cb)); this.registerEmbarkJs(); this.registerConsoleCommands(); + this.registerApi(); + } + + registerApi() { + let plugin = this.plugins.createPlugin('consoleApi', {}); + plugin.registerAPICall('post', '/embark-api/command', (req, res) => { + this.executeCmd(req.body.command, (_err, result) => { + res.send({result}); + }); + }); } processEmbarkCmd (cmd) {