kibana/docs/development/core/server/kibana-plugin-server.httpservicesetup.createrouter.md
2019-11-18 17:17:48 +01:00

957 B

Home > kibana-plugin-server > HttpServiceSetup > createRouter

HttpServiceSetup.createRouter property

Provides ability to declare a handler function for a particular path and HTTP request method.

Signature:

createRouter: () => IRouter;

Remarks

Each route can have only one handler function, which is executed when the route is matched. See the IRouter documentation for more information.

Example

const router = createRouter();
// handler is called when '/path' resource is requested with `GET` method
router.get({ path: '/path', validate: false }, (context, req, res) => res.ok({ content: 'ok' }));