Back in Kibana 4.5.0, I had a plugin acting as a REST API endpoint using the following code:
// plugins/plugin_name/index.js
export default function (kibana) {
const http = require('http');
return new kibana.Plugin({
config: Joi => {
return Joi.object({
enabled: Joi.boolean().default(true)
}).default();
},
require: ['kibana'],
init(server, options) {
server.route({
method: 'POST',
path: '...',
handler: (req, reply) => { ... }
})
}
})
}
// tasks/config/copy.js
installPlugins: {
options: { mode: true },
src: [
'plugins/plugin_name/**'
],
dest: 'build/kibana',
expand: true
}
I then call the API endpoint using the $http module within a visualization. I have ported the code to Kibana 6 and though, in the logs, it says that the plugin's status changed from uninitialized to green - ready, the client returns a 404 when hitting the API endpoint.
I can't seem to find the new way of doing this in the docs, so if anyone has any ideas, let me know! Thank you!