feat(go-api): wire REST endpoints, gRPC client, and request middleware#30
Open
Depo-dev wants to merge 4 commits into
Open
feat(go-api): wire REST endpoints, gRPC client, and request middleware#30Depo-dev wants to merge 4 commits into
Depo-dev wants to merge 4 commits into
Conversation
Generates Go proto bindings from proto/trident.proto using buf. Wires
three REST handlers (GET /v1/health, GET /v1/events, GET /v1/events/{id})
that proxy to the Rust gRPC API via google.golang.org/grpc. Adds
RequestID middleware (random hex ID in context + X-Request-ID header) and
Logging middleware (slog JSON: method/path/status/latency/request_id).
All four deps added to go.mod: grpc, protobuf, pgx/v5, go-redis/v9.
Handler tests use a mock EventsClient and httptest; all pass with go vet
clean.
…lint to bypass version check
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
Implements the three core REST endpoints backed by the Rust gRPC API, plus request middleware.
What's included
proto/trident.proto— addsgo_packageoption for Go codegenbuf.yaml+buf.gen.yaml— buf configuration for Go proto generationservices/api/internal/proto/— committed generated Go gRPC client (buf-generated)services/api/handlers/events.go—GET /v1/health,GET /v1/events,GET /v1/events/{id}; proxies to gRPC, mapscodes.NotFound→ 404,codes.InvalidArgument→ 400services/api/handlers/events_test.go— 5 httptest-based tests using a mockEventsClientservices/api/middleware/logging.go—RequestID(rand hex + X-Request-ID header) andLogging(slog JSON: method/path/status/latency_ms/request_id)services/api/main.go— wires gRPC dial (GRPC_API_ADDRenv, defaultlocalhost:50051), registers routes, chains middlewareservices/api/go.mod/go.sum— addsgrpc,protobuf,pgx/v5,go-redis/v9Tests
Closes #14