Enforcing RouteRefs more: docs, templates, types

This commit is contained in:
Ivan Shmidt
2020-06-03 16:40:13 +02:00
parent 239c1a0e3f
commit 0a13a11f7b
6 changed files with 102 additions and 21 deletions
+10 -4
View File
@@ -43,13 +43,19 @@ In the root folder you have some configuration for typescript and jest, the test
In the `src` folder we get to the interesting bits. Check out the `plugin.ts`:
```jsx
import { createPlugin } from '@backstage/core';
import { createPlugin, createRouteRef } from '@backstage/core';
import ExampleComponent from './components/ExampleComponent';
export default createPlugin({
id: 'new-plugin',
export const rootRouteRef = createRouteRef({
icon: () => null,
path: '/{{ id }}',
title: '{{ id }}',
});
export const plugin = createPlugin({
id: '{{ id }}',
register({ router }) {
router.registerRoute('/new-plugin', ExampleComponent);
router.addRoute(rootRouteRef, ExampleComponent);
},
});
```