I have a number of microservices that are both REST and gRPC. I'm planning to create a simple API gateway in Go so that a server in my local machine can access these microservices through 1 entry. The purpose is for development, i.e when I develop a new microservice, I don't have to re-create all its dependencies, I can just access it from a test server's API gateway that already have them all deployed.
Say I have two services:
- ArticleService - a simple REST API with JSON request and response
- UserService - a gRPC service accepting and returning protobufs
I want the gateway to be able to reverse proxy to these services, such as:
- At
{IP}/articles
, it will direct to ArticleService (JSON request) - At
{IP}/user
, it will direct to UserService (request to{IP}/user
is sent in protobuf, not JSON)
Unfortunately, I couldn't find much resource on how to write a HTTP2 server that can decode the data frames, read the path, and forward the request to a gRPC service. The only thing I could find is grpc-gateway
but it's more of a reverse proxy for JSON request to gRPC service, instead of direct protobuf request.
Any help would be appreciated. Thanks!