use existing api instead of creating a new plugin

This commit is contained in:
Iuri Matias 2018-10-15 21:54:32 -04:00 committed by Pascal Precht
parent d1a7960cbe
commit 2453d686eb
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 2 additions and 2 deletions

View File

@ -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})
});