How carteruysl/grpc-fiber works
Project type and purpose
• This is a small Go‐based microservice demo that exposes a Unary gRPC service (Add, Mult) and also provides an HTTP/REST facade (using the Fiber framework) for ease of testing with curl or other HTTP clients. It is organized as two distinct binaries (Client and Server) plus a shared proto directory for the service contract.
File structure
• Top level
• Client/… → Go program that acts as a gRPC client
• Server/… → Go program that hosts both the gRPC server and an HTTP server (Fiber)
• proto/… → Protocol Buffer definition (file.proto) and the generated Go stubs (file.pb.go, file_grpc.pb.go)
• go.mod, go.sum → module and dependency management for the server
• Key patterns
• Service contract in proto files
• Separation of client and server executables
• Dual‐face server: gRPC + HTTP
README for additional insights
• Instructions to install protoc‐gen‐go and protoc‐gen‐go‐grpc
• Commands to regenerate the stubs
• How to launch server (go run server/main.go) and client (go run client/main.go)
• HTTP endpoints documented:
GET /add/:a/:b → returns sum
GET /mult/:a/:b → returns product