First install required dependencies:
- docker
- docker-compose (if not provided by docker install)
- buf
Then start the stack:
docker-compose up -d
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)
Name | Host | Description |
---|---|---|
gRPC server | localhost:50051 | The gRPC server (go) |
gRPC gateway | localhost:8888 | The gRPC gateway (go) |
gRPC envoy proxy | localhost:9999 | The gRPC envoy proxy (envoy) |
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 .
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:
Endpoint | Description |
---|---|
[POST] /v1/transform | To call with REST the TransformText rpc |
[POST] /v1/transform-and-split | To call with REST the TransformAndSplitText rpc |
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.