backstage-grpc-playground-backend
Overview
This repo contains backend code of the backstage-grpc-playground
Install
Install backstage-grpc-playground-backend for packages/backend
E.g: In your backstage project root
yarn --cwd packages/backend add backstage-grpc-playground-backend
Usage
Register the plugin in backend
Create a new file packages/backend/src/plugins/grpc-playground.ts
import { ScmIntegrations } from '@backstage/integration';
import { createRouter } from 'backstage-grpc-playground-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const { config, reader } = env;
const integrations = ScmIntegrations.fromConfig(config);
return await createRouter({
logger: env.logger,
reader,
integrations,
});
}
Register /grpc-playground
path in backstage backend
import grpcPlayground from './plugins/grpc-playground';
async function main() {
const grpcPlaygroundEnv = useHotMemoize(module, () => createEnv('grpc-playground'));
apiRouter.use('/grpc-playground', await grpcPlayground(grpcPlaygroundEnv));
apiRouter.use(notFoundHandler());
}
Examples
See examples
Acknowledgements