gRPC-Gateway REST and gRPC

gRPC-Gateway generates a REST API from gRPC definitions, translating HTTP/JSON requests into gRPC calls for unified service exposure.

gRPC-Gateway automatically generates a REST API layer that translates incoming HTTP/JSON requests into gRPC calls, allowing you to serve both protocols from a single backend. You configure this by defining HTTP annotations in your .proto files and running the protoc compiler with the grpc-gateway plugin to generate the necessary Go code.

protoc -I. \
  --go_out=. --go_opt=paths=source_relative \
  --go-grpc_out=. --go-grpc_opt=paths=source_relative \
  --grpc-gateway_out=. --grpc-gateway_opt=paths=source_relative \
  --grpc-gateway_opt=logtostderr=true \
  your_service.proto