Giter Club home page Giter Club logo

backstage-grpc-playground-backend's Introduction

backstage-grpc-playground-backend

GitHub Project Level GitHub issues GitHub contributors GitHub code size in bytes

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

// 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,
    database: env.database,
  });
}

Register /grpc-playground path in backstage backend

// packages/backend/src/index.ts
import grpcPlayground from './plugins/grpc-playground';

async function main() {
  // other env
  const grpcPlaygroundEnv = useHotMemoize(module, () => createEnv('grpc-playground'));
  
  // init router
  // ...

  // register before notFoundHandler  
  apiRouter.use('/grpc-playground', await grpcPlayground(grpcPlaygroundEnv));

  // not found handler
  apiRouter.use(notFoundHandler());
}

Examples

See examples

Acknowledgements

backstage-grpc-playground-backend's People

Contributors

fr0stf0x avatar nishkarshraj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

backstage-grpc-playground-backend's Issues

Support Proto Upload path to GCS

We horizontally scale our backstage backend servers on k8s.

grpc-playground works in two steps.

  1. call to /proto-info/:entity endpoint. where the proto definition is copied to local file.
  2. call to /send-request/:entity where the actual call is made.

now if there are two pods backstage backend, first call can go to first pod, and second call can go to second pods, and cause missing proto error.

Is there a way to solve this by having a common source for .proto files, say like GCS/S3 bucket.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.