plugins/graphiql: add GitHub endpoint with automatic scope detection

This commit is contained in:
Patrik Oldsberg
2020-06-23 21:18:28 +02:00
parent 45cdbdd4b7
commit cd7c1efb13
2 changed files with 108 additions and 2 deletions
+12 -2
View File
@@ -15,15 +15,25 @@
*/
import { createDevApp } from '@backstage/dev-utils';
import { githubAuthApiRef, errorApiRef } from '@backstage/core';
import { plugin, GraphQLEndpoints, graphQlBrowseApiRef } from '../src';
createDevApp()
.registerPlugin(plugin)
.registerApiFactory({
implements: graphQlBrowseApiRef,
deps: {},
factory() {
deps: {
errorApi: errorApiRef,
githubAuthApi: githubAuthApiRef,
},
factory({ errorApi, githubAuthApi }) {
return GraphQLEndpoints.from([
GraphQLEndpoints.github({
id: 'github',
title: 'GitHub',
errorApi,
githubAuthApi,
}),
GraphQLEndpoints.create({
id: 'gitlab',
title: 'GitLab',