Skip to content

Latest commit

 

History

History
28 lines (16 loc) · 954 Bytes

kibana-plugin-core-server.httpservicesetup.createrouter.md

File metadata and controls

28 lines (16 loc) · 954 Bytes

Home > kibana-plugin-core-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' }));