mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
parent
dd5f7db7f4
commit
bf75969ab0
3 changed files with 6 additions and 6 deletions
|
@ -21,7 +21,7 @@ Each route can have only one handler function, which is executed when the route
|
|||
|
||||
```ts
|
||||
const router = createRouter();
|
||||
// handler is called when '${my-plugin-id}/path' resource is requested with `GET` method
|
||||
// handler is called when '/path' resource is requested with `GET` method
|
||||
router.get({ path: '/path', validate: false }, (context, req, res) => res.ok({ content: 'ok' }));
|
||||
|
||||
```
|
||||
|
|
|
@ -27,7 +27,7 @@ export interface HttpServiceSetup
|
|||
|
||||
## Example
|
||||
|
||||
To handle an incoming request in your plugin you should: - Create a `Router` instance. Router is already configured to use `plugin-id` to prefix path segment for your routes.
|
||||
To handle an incoming request in your plugin you should: - Create a `Router` instance.
|
||||
|
||||
```ts
|
||||
const router = httpSetup.createRouter();
|
||||
|
@ -61,7 +61,7 @@ const handler = async (context: RequestHandlerContext, request: KibanaRequest, r
|
|||
}
|
||||
|
||||
```
|
||||
- Register route handler for GET request to 'my-app/path/<!-- -->{<!-- -->id<!-- -->}<!-- -->' path
|
||||
- Register route handler for GET request to 'path/<!-- -->{<!-- -->id<!-- -->}<!-- -->' path
|
||||
|
||||
```ts
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
|
|
|
@ -52,7 +52,7 @@ export type RequestHandlerContextProvider<
|
|||
*
|
||||
* @example
|
||||
* To handle an incoming request in your plugin you should:
|
||||
* - Create a `Router` instance. Router is already configured to use `plugin-id` to prefix path segment for your routes.
|
||||
* - Create a `Router` instance.
|
||||
* ```ts
|
||||
* const router = httpSetup.createRouter();
|
||||
* ```
|
||||
|
@ -87,7 +87,7 @@ export type RequestHandlerContextProvider<
|
|||
* }
|
||||
* ```
|
||||
*
|
||||
* - Register route handler for GET request to 'my-app/path/{id}' path
|
||||
* - Register route handler for GET request to 'path/{id}' path
|
||||
* ```ts
|
||||
* import { schema, TypeOf } from '@kbn/config-schema';
|
||||
* const router = httpSetup.createRouter();
|
||||
|
@ -184,7 +184,7 @@ export interface HttpServiceSetup {
|
|||
* @example
|
||||
* ```ts
|
||||
* const router = createRouter();
|
||||
* // handler is called when '${my-plugin-id}/path' resource is requested with `GET` method
|
||||
* // handler is called when '/path' resource is requested with `GET` method
|
||||
* router.get({ path: '/path', validate: false }, (context, req, res) => res.ok({ content: 'ok' }));
|
||||
* ```
|
||||
* @public
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue