mirror of https://github.com/embarklabs/embark.git
use existing api instead of creating a new plugin
This commit is contained in:
parent
d1a7960cbe
commit
2453d686eb
|
@ -2,6 +2,7 @@ let utils = require('../../utils/utils');
|
|||
|
||||
class Suggestions {
|
||||
constructor(embark, options) {
|
||||
this.embark = embark;
|
||||
this.events = embark.events;
|
||||
this.plugins = options.plugins;
|
||||
this.registerApi();
|
||||
|
@ -10,8 +11,7 @@ class Suggestions {
|
|||
}
|
||||
|
||||
registerApi() {
|
||||
let plugin = this.plugins.createPlugin('consoleApi', {});
|
||||
plugin.registerAPICall('post', '/embark-api/suggestions', (req, res) => {
|
||||
this.embark.registerAPICall('post', '/embark-api/suggestions', (req, res) => {
|
||||
let suggestions = this.getSuggestions(req.body.command)
|
||||
res.send({result: suggestions})
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue