Files
backstage/docs/reference/createPlugin.md
T
2020-03-25 19:12:11 +01:00

758 B

createPlugin

Taking a plugin config as argument and returns a new plugin.

Plugin Config

function createPlugin(config: PluginConfig): BackstagePlugin;

type PluginConfig = {
  id: string;
  register?(hooks: PluginHooks): void;
};

type PluginHooks = {
  router: RouterHooks;
};

Read more about the router here

Example Uses

Creating a basic plugin

Showcasing adding multiple routes and a redirect.

import { createPlugin } from '@backstage/core';
import ExampleComponent from './components/ExampleComponent';

export default createPlugin({
  id: 'new-plugin',
  register({ router }) {
    router.registerRoute('/new-plugin', ExampleComponent);
  },
});

Back to References