feat: add gRPC server support (Closes #100)#116
Open
ljluestc wants to merge 2 commits intoxinliangnote:masterfrom
Open
feat: add gRPC server support (Closes #100)#116ljluestc wants to merge 2 commits intoxinliangnote:masterfrom
ljluestc wants to merge 2 commits intoxinliangnote:masterfrom
Conversation
Clarify that go-gin-api currently focuses on HTTP/REST, GraphQL, and WebSocket, and does not include built-in gRPC server or .proto definitions. Refs xinliangnote#100 Co-Authored-By: Oz <oz-agent@warp.dev>
Closes xinliangnote#100 - Add protobuf definitions under api/proto/ - Implement gRPC server with unary interceptors (logging + panic recovery) - Add HealthService (health check) and HelloService (sample) implementations - Integrate gRPC server lifecycle into main.go (startup + graceful shutdown) - gRPC server listens on port :9998 alongside HTTP on :9999 - Add google.golang.org/grpc dependency - Update README to document gRPC support Co-Authored-By: Oz <oz-agent@warp.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds gRPC server support to go-gin-api, addressing #100 which reported that gRPC functionality was missing from the codebase.
Changes
New Files
api/proto/service.proto— Protobuf definitions forHealthServiceandHelloServiceinternal/grpc/pb/— Generated Go protobuf + gRPC stubs (message types and server registration)internal/grpc/interceptor/interceptor.go— Unary server interceptors:UnaryLogInterceptor— Logs every gRPC call with method name, duration, and errors (using zap)UnaryRecoveryInterceptor— Recovers from panics and returnscodes.Internalinternal/grpc/service/health.go—HealthServiceimplementation (always returnsSERVING)internal/grpc/service/hello.go—HelloServiceimplementation with trace ID propagation via gRPC metadatainternal/grpc/server/server.go— gRPC server setup with chained interceptors and service registrationModified Files
main.go— Initializes gRPC server on:9998, runs alongside HTTP server, adds graceful shutdown hookconfigs/constants.go— AddsProjectGRPCPort = ":9998"go.mod/go.sum— Addsgoogle.golang.org/grpc v1.46.0README.md— Documents gRPC as an integrated componentArchitecture
Testing
Conversation link
Co-Authored-By: Oz oz-agent@warp.dev