diff --git a/server/plugin.ts b/server/plugin.ts index adb7c48..3b992f1 100644 --- a/server/plugin.ts +++ b/server/plugin.ts @@ -17,6 +17,8 @@ * under the License. */ +import type { DataRequestHandlerContext } from 'src/plugins/data/server'; + import { PluginInitializerContext, CoreSetup, @@ -31,7 +33,7 @@ import { KibanaMilestonesVisPluginSetupDeps, KibanaMilestonesVisPluginStartDeps, } from './types'; -import { registerRoutes } from './routes'; +import { defineRoutes } from './routes'; export class KibanaMilestonesVisPlugin implements @@ -40,7 +42,8 @@ export class KibanaMilestonesVisPlugin KibanaMilestonesVisPluginStart, KibanaMilestonesVisPluginSetupDeps, KibanaMilestonesVisPluginStartDeps - > { + > +{ private readonly logger: Logger; constructor(initializerContext: PluginInitializerContext) { @@ -49,10 +52,10 @@ export class KibanaMilestonesVisPlugin public setup(core: CoreSetup) { this.logger.debug('kibanaMilestonesVis: Setup'); - const router = core.http.createRouter(); + const router = core.http.createRouter(); core.getStartServices().then(() => { - registerRoutes(router); + defineRoutes(router); }); return {}; diff --git a/server/routes/define_routes.ts b/server/routes/define_routes.ts new file mode 100644 index 0000000..c2a16b2 --- /dev/null +++ b/server/routes/define_routes.ts @@ -0,0 +1,9 @@ +import type { IRouter } from 'kibana/server'; + +import type { DataRequestHandlerContext } from 'src/plugins/data/server'; + +import { defineServerSearchRoute } from './server_search_route'; + +export function defineRoutes(router: IRouter) { + defineServerSearchRoute(router); +} diff --git a/server/routes/index.ts b/server/routes/index.ts index 5fa6346..9ab958d 100644 --- a/server/routes/index.ts +++ b/server/routes/index.ts @@ -1 +1 @@ -export { registerRoutes } from './register_routes'; +export { defineRoutes } from './define_routes'; diff --git a/server/routes/register_routes.ts b/server/routes/register_routes.ts deleted file mode 100644 index 14eed7a..0000000 --- a/server/routes/register_routes.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IRouter } from 'kibana/server'; -import { registerServerSearchRoute } from './server_search_route'; - -export function registerRoutes(router: IRouter) { - registerServerSearchRoute(router); -} diff --git a/server/routes/server_search_route.ts b/server/routes/server_search_route.ts index 0b9f2a8..24bdee0 100644 --- a/server/routes/server_search_route.ts +++ b/server/routes/server_search_route.ts @@ -1,11 +1,15 @@ import { get } from 'lodash'; -import { IEsSearchRequest } from 'src/plugins/data/server'; + import { schema } from '@kbn/config-schema'; -import { IEsSearchResponse } from 'src/plugins/data/common'; -import { IRouter } from '../../../../src/core/server'; + +import type { DataRequestHandlerContext, IEsSearchRequest } from 'src/plugins/data/server'; +import type { IEsSearchResponse } from 'src/plugins/data/common'; + +import type { IRouter } from '../../../../src/core/server'; + import { NONE_SELECTED, SERVER_SEARCH_ROUTE_PATH } from '../../common'; -export function registerServerSearchRoute(router: IRouter) { +export function defineServerSearchRoute(router: IRouter) { router.post( { path: SERVER_SEARCH_ROUTE_PATH,