migrate graphql-backend plugin to the new backend system

Signed-off-by: zcason <a-zcason@expediagroup.com>
This commit is contained in:
zcason
2023-09-18 11:25:00 -05:00
parent 54b411d9ae
commit 00cf54df4c
6 changed files with 52 additions and 0 deletions
+1
View File
@@ -38,6 +38,7 @@
"@backstage/plugin-catalog-backend-module-unprocessed": "workspace:^",
"@backstage/plugin-devtools-backend": "workspace:^",
"@backstage/plugin-entity-feedback-backend": "workspace:^",
"@backstage/plugin-graphql-backend": "workspace:^",
"@backstage/plugin-kubernetes-backend": "workspace:^",
"@backstage/plugin-lighthouse-backend": "workspace:^",
"@backstage/plugin-linguist-backend": "workspace:^",
+1
View File
@@ -29,6 +29,7 @@ backend.add(
backend.add(import('@backstage/plugin-catalog-backend/alpha'));
backend.add(import('@backstage/plugin-devtools-backend'));
backend.add(import('@backstage/plugin-entity-feedback-backend'));
backend.add(import('@backstage/plugin-graphql-backend'));
backend.add(import('@backstage/plugin-kubernetes-backend/alpha'));
backend.add(import('@backstage/plugin-lighthouse-backend'));
backend.add(import('@backstage/plugin-linguist-backend'));
+5
View File
@@ -3,6 +3,7 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { BackendFeature } from '@backstage/backend-plugin-api';
import { Config } from '@backstage/config';
import express from 'express';
import { Logger } from 'winston';
@@ -10,6 +11,10 @@ import { Logger } from 'winston';
// @public (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;
// @public
const graphqlPlugin: () => BackendFeature;
export default graphqlPlugin;
// @public (undocumented)
export interface RouterOptions {
// (undocumented)
+1
View File
@@ -21,3 +21,4 @@
*/
export * from './service/router';
export { graphqlPlugin as default } from './plugin';
+42
View File
@@ -0,0 +1,42 @@
/*
* Copyright 2023 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
coreServices,
createBackendPlugin,
} from '@backstage/backend-plugin-api';
import { createRouter } from './service/router';
import { loggerToWinstonLogger } from '@backstage/backend-common';
export const graphqlPlugin = createBackendPlugin({
pluginId: 'graphql',
register(env) {
env.registerInit({
deps: {
config: coreServices.rootConfig,
http: coreServices.httpRouter,
logger: coreServices.logger,
},
async init({ config, http, logger }) {
http.use(
await createRouter({
config,
logger: loggerToWinstonLogger(logger),
}),
);
},
});
},
});
+2
View File
@@ -7280,6 +7280,7 @@ __metadata:
dependencies:
"@apollo/server": ^4.0.0
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
"@backstage/plugin-catalog-graphql": "workspace:^"
@@ -25960,6 +25961,7 @@ __metadata:
"@backstage/plugin-catalog-backend-module-unprocessed": "workspace:^"
"@backstage/plugin-devtools-backend": "workspace:^"
"@backstage/plugin-entity-feedback-backend": "workspace:^"
"@backstage/plugin-graphql-backend": "workspace:^"
"@backstage/plugin-kubernetes-backend": "workspace:^"
"@backstage/plugin-lighthouse-backend": "workspace:^"
"@backstage/plugin-linguist-backend": "workspace:^"