package
1.0.1
Repository: https://github.com/project-flogo/grpc.git
Documentation: pkg.go.dev

# README

gRPC to Rest

This recipe is a proxy gateway for gRPC end points.

Installation

  • Install Go

Setup

git clone https://github.com/project-flogo/grpc
cd grpc/examples/api/grpc-to-rest
go build

Testing

Start proxy gateway.

./grpc-to-rest

Start sample gRPC server.

./grpc-to-rest -server

#1 Testing PetById method

Run sample gRPC client.

./grpc-to-rest -client -port 9096 -method pet -param 2

Now you should see logs in proxy gateway terminal and sample gRPC server terminal. Sample output in client terminal can be seen as below.

res : pet:<id:2 name:"cat2" >

#2 Testing UserByName method

Run sample gRPC client.

./grpc-to-rest -client -port 9096 -method user -param user2

Output can be seen as below.

res : user:<id:2 username:"user2" email:"email2" phone:"phone2" >

#3 Testing ListUsers(Server Streaming) method

Run sample gRPC client.

./grpc-to-rest -client -port 9096 -method listusers

Streaming data can be observed at client side. Interrupt the sample server to stop streaming.

#4 Testing StoreUsers(Client Streaming) method

Run sample gRPC client.

./grpc-to-rest -client -port 9096 -method storeusers

Streaming data can be observed at server side. Interrupt the client to stop streaming.

#5 Testing BulkUsers(Bidirectional Streaming) method

Run sample gRPC client.

./grpc-to-rest -client -port 9096 -method bulkusers

Streaming data can be observed at both client and server side. One second delay is kept for veiwing purpose.