Categorygithub.com/ekkinox/grpc-demo
module
0.0.0-20220506200644-1be965408a46
Repository: https://github.com/ekkinox/grpc-demo.git
Documentation: pkg.go.dev

# README

🚀 gRPC: SOA booster

Introduction session to gRPC as SOA booster using Golang.

Table of contents

Installation

First install required dependencies:

Then start the stack:

docker-compose up -d

Stubs generation

The protoc stubs are generated using Buf, following rules in buf.gen.yaml file.

To launch a new generation:

buf generate

Then check the proto folder where you'll find:

  • go: golang generated stubs for gRPC server and gRPC gateway
  • js: javascript generated stubs for web clients
  • php: PHP generated stubs for PHP application (as gRPC client)

Available services

NameHostDescription
gRPC serverlocalhost:50051The gRPC server (go)
gRPC gatewaylocalhost:8888The gRPC gateway (go)
gRPC envoy proxylocalhost:9999The gRPC envoy proxy (envoy)

gRPC server

This application is a simple server side go implementation of the text_tools.proto Protobuf definition.

The code is located in server folder.

You can access it on localhost:50051, and use the provided client/main.go script to interact with it:

cd client && go run .

gRPC gateway

This application is a REST <-> gRPC reverse proxy using autogenerated protoc stubs.

The code is located in gateway folder.

You can access it on localhost:8888 to interact with it on following endpoint:

EndpointDescription
[POST] /v1/transformTo call with REST the TransformText rpc
[POST] /v1/transform-and-splitTo call with REST the TransformAndSplitText rpc

gRPC envoy proxy

This envoy proxy is running the envoy.filters.http.grpc_web filter to enable frontend application to interact using gRPC-web.

The proxy configuration is located in envoy folder.

You can access it on localhost:9999 to interact with it, and use the frontend client to test from a web application.

# Packages

No description provided by the author