Skip to content

Latest commit

 

History

History
78 lines (54 loc) · 2.33 KB

README.md

File metadata and controls

78 lines (54 loc) · 2.33 KB

gRPCFlair

codecov

This is a tool to help you interact with gRPC services. You can use it to explore the service's endpoints and make requests to them, browse types and enums, and preview options.

preview

Prerequisites

To run this application, you need to have the libraries installed.

pnpm install

Usage

Here are the commands you can use to run the application or generate JSON prescription for the proto files.

Website

Development

To run the website in development mode, use the following command.

pnpm -C web run dev

Production

To run the website in production mode, use the following commands. First, build the website and then start the server. The server will be available at http://localhost:3000 by default.

pnpm -C web run build
pnpm -C web run start

JSON Generation

Generate a JSON from the proto files. The source files can be a single file or a list of files separated by a space or a folder/folders.

gf-proto-to-json ${SOURCE_PROTO_FILES} > ${EXPORTED_NAME}.json

Reflection to JSON Generation

  1. Create a protoset file (it can be done using different ways, this is just an example).
grpcurl -protoset-out descriptors.bin -plaintext localhost:8980 describe
  1. Generate a JSON from the protoset file. The file should be a single file in the .bin format.
gf-reflection-to-json ${SOURCE_BIN_FILE} > ${EXPORTED_NAME}.json

Testing Server

To test the application, you can use the example testing server and Envoy proxy. It is a simple gRPC server that has a few endpoints and types. Source: https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/helloworld

  1. Go to the example folder.
cd example
  1. Start the Envoy proxy.

(Linux users: Use address: localhost instead of address: host.docker.internal in the bottom section.)

docker run -d -v "$(pwd)"/envoy-proxy.yaml:/etc/envoy/envoy.yaml:ro -p 8080:8080 -p 9901:9901 envoyproxy/envoy:v1.22.0
  1. Run the gRPC server.
node server.js
  1. Access the (already running) website and set the server URL to http://localhost:8080.