Skip to content

Instantly share code, notes, and snippets.

@larkintuckerllc
Created March 8, 2022 00:28
Show Gist options
  • Save larkintuckerllc/328bfcc13f33fe6ee55f824c5e35cbb7 to your computer and use it in GitHub Desktop.
Save larkintuckerllc/328bfcc13f33fe6ee55f824c5e35cbb7 to your computer and use it in GitHub Desktop.
import {
createApiFactory,
createPlugin,
createRoutableExtension,
discoveryApiRef,
} from '@backstage/core-plugin-api';
import { MyPluginBackendClient } from './api/MyPluginBackendClient';
import { myPluginApiRef } from './api/types';
import { rootCatalogMyPluginRouteRef } from './routes';
export const myPluginPlugin = createPlugin({
id: 'my-plugin',
apis: [
createApiFactory({
api: myPluginApiRef,
deps: {
discoveryApi: discoveryApiRef,
},
factory: ({ discoveryApi }) =>
new MyPluginBackendClient({ discoveryApi }),
}),
],
routes: {
root: rootCatalogMyPluginRouteRef,
},
});
export const EntityMyPluginContent = myPluginPlugin.provide(
createRoutableExtension({
name: 'EntityMyPluginContent',
component: () =>
import('./components/ExampleComponent').then(m => m.ExampleComponent),
mountPoint: rootCatalogMyPluginRouteRef,
}),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment