Skip to content

Commit

Permalink
Update APM Plugin Routing and Linking (elastic#115008) (elastic#115151)
Browse files Browse the repository at this point in the history
* Update client-side and server-side routing function names and files

Co-authored-by: Giorgos Bamparopoulos <georgios.bamparopoulos@elastic.co>
  • Loading branch information
kibanamachine and gbamparop authored Oct 15, 2021
1 parent 86149f0 commit e35e1a4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions x-pack/plugins/apm/dev_docs/routing_and_linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ This document describes routing in the APM plugin.

### Server-side

Route definitions for APM's server-side API are in the [server/routes directory](../server/routes). Routes are created with [the `createRoute` function](../server/routes/create_route.ts). Routes are added to the API in [the `createApmApi` function](../server/routes/create_apm_api.ts), which is initialized in the plugin `start` lifecycle method.
Route definitions for APM's server-side API are in the [server/routes directory](../server/routes). Routes are created with [the `createApmServerRoute` function](../server/routes/create_apm_server_route.ts). Routes are added to the API in [the `registerRoutes` function](../server/routes/register_routes.ts), which is initialized in the plugin `setup` lifecycle method.

The path and query string parameters are defined in the calls to `createRoute` with io-ts types, so that each route has its parameters type checked.
The path and query string parameters are defined in the calls to `createApmServerRoute` with io-ts types, so that each route has its parameters type checked.

### Client-side

The client-side routing uses `@kbn/typed-react-router-config`, which is a wrapper around [React Router](https://reactrouter.com/) and [React Router Config](https://www.npmjs.com/package/react-router-config). Its goal is to provide a layer of high-fidelity types that allows us to parse and format URLs for routes while making sure the needed parameters are provided and/or available (typed and validated at runtime). The `history` object used by React Router is injected by the Kibana Platform.

Routes (and their parameters) are defined in [public/components/routing/apm_config.tsx](../public/components/routing/apm_config.tsx).
Routes (and their parameters) are defined in [public/components/routing/apm_route_config.tsx](../public/components/routing/apm_route_config.tsx).

#### Parameter handling

Expand Down

0 comments on commit e35e1a4

Please sign in to comment.