UNPKG

@spalger/kibana

Version:

Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic

26 lines (22 loc) 716 B
module.exports = function (kbnServer, server, config) { var _ = require('lodash'); var Promise = require('bluebird'); var Boom = require('boom'); var { join } = require('path'); server.exposeStaticDir('/plugins/{id}/{path*}', function (req) { var id = req.params.id; var plugin = kbnServer.plugins.byId[id]; return (plugin && plugin.publicDir) ? plugin.publicDir : Boom.notFound(); }); server.method('kbnPluginById', function (id, next) { if (kbnServer.plugins.byId[id]) { next(null, kbnServer.plugins.byId[id]); } else { next(Boom.notFound(`no plugin with the id "${id}"`)); } }); return kbnServer.mixin( require('./scan'), require('./load') ); };