app: move api factories out to plugins

This commit is contained in:
Patrik Oldsberg
2020-09-04 17:09:41 +02:00
parent db291ab323
commit aa235dd154
12 changed files with 134 additions and 87 deletions
+9 -1
View File
@@ -14,13 +14,21 @@
* limitations under the License.
*/
import { createPlugin } from '@backstage/core';
import { createPlugin, createApiFactory, configApiRef } from '@backstage/core';
import AuditList from './components/AuditList';
import AuditView from './components/AuditView';
import CreateAudit from './components/CreateAudit';
import { lighthouseApiRef, LighthouseRestApi } from './api';
export const plugin = createPlugin({
id: 'lighthouse',
apis: [
createApiFactory({
implements: lighthouseApiRef,
deps: { configApi: configApiRef },
factory: ({ configApi }) => LighthouseRestApi.fromConfig(configApi),
}),
],
register({ router }) {
router.registerRoute('/lighthouse', AuditList);
router.registerRoute('/lighthouse/audit/:id', AuditView);