{"id":16885123,"url":"https://github.com/ericchiang/grpc-http-go","last_synced_at":"2026-04-13T17:32:56.727Z","repository":{"id":81890082,"uuid":"606251682","full_name":"ericchiang/grpc-http-go","owner":"ericchiang","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-20T21:04:49.000Z","size":119,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-14T05:28:57.307Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericchiang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-25T00:19:20.000Z","updated_at":"2025-03-20T21:01:14.000Z","dependencies_parsed_at":"2025-03-19T00:00:16.998Z","dependency_job_id":null,"html_url":"https://github.com/ericchiang/grpc-http-go","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ericchiang/grpc-http-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchiang%2Fgrpc-http-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchiang%2Fgrpc-http-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchiang%2Fgrpc-http-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchiang%2Fgrpc-http-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericchiang","download_url":"https://codeload.github.com/ericchiang/grpc-http-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericchiang%2Fgrpc-http-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31762536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T15:25:13.801Z","status":"ssl_error","status_checked_at":"2026-04-13T15:25:09.162Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T16:33:26.490Z","updated_at":"2026-04-13T17:32:56.709Z","avatar_url":"https://github.com/ericchiang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gRPC HTTP annotations for Go\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/ericchiang/grpc-http-go/grpchttp.svg)](https://pkg.go.dev/github.com/ericchiang/grpc-http-go/grpchttp)\n\nA Go implementation of [gRPC to HTTP/JSON transcoding][grpc-to-http] using\nGoogle's [HTTP Protobuf annotations][grpc-http-annotations].\n\nTo use, define a gRPC service with HTTP bindings:\n\n```proto\nsyntax = \"proto3\";\n\n// ...\n\nimport \"google/api/annotations.proto\";\n\nservice Test {\n  rpc GetItem(GetItemRequest) returns(Item) {\n    option (google.api.http) = { \n      get: \"/v1/items/{name=*}\"\n    };\n  } \n}\n\nmessage Item {\n  string name = 1;\n  int64 id = 2;\n}\n\nmessage GetItemRequest {\n  string name = 1;\n}\n```\n\nGenerate the Protobuf and gRPC packages using [gRPC's Go support][grpc-go].\nAfter implememeting the service, the grpchttp package can be used to create a\n[net/http.Handler][http-handler]:\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n    \"net/http\"\n\n    \"github.com/ericchiang/grpc-http-go/grpchttp\"\n\n    pb \"example.com/testservice\"\n)\n\ntype service struct {}\n\nfunc (s *service) GetItem(ctx context.Context, req *pb.GetItemRequest) (*pb.Item, error) {\n    return \u0026pb.Item{Name: req.GetName(), Id: 42}, nil\n}\n\nfunc main() {\n    srv := \u0026service{}\n    hander, err := grpchttp.NewHandler(\u0026pb.Test_ServiceDesc, srv)\n    if err != nil {\n        log.Fatalf(\"creating HTTP handler: %v\", err)\n    }\n    log.Fatal(http.ListenAndServe(\":8080\", handler))\n}\n```\n\nRequest and responses will automatically be converted using the annotation rules\nand Protobuf's JSON support:\n\n```\n$ curl -s http://localhost:8080/v1/items/myitem | jq .\n{\n  \"name\": \"myitem\",\n  \"id\": \"42\"\n}\n```\n\nThis project is compariable to gRPC to HTTP/JSON support that exists\n[gRPC-Gateway][grpc-gateway] and [Envoy][envoy], which are aim at larger scale\ndeployments of gRPC services. The grpchttp package aims to be a good solution\nfor single binaries written in Go to quickly support HTTP bindings without\ncustom proto generators.\n\n[envoy]: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/grpc_json_transcoder_filter\n[grpc-gateway]: https://github.com/grpc-ecosystem/grpc-gateway\n[grpc-go]: https://grpc.io/docs/languages/go/basics/\n[grpc-http-annotations]: https://github.com/googleapis/googleapis/blob/master/google/api/http.proto\n[grpc-to-http]: https://cloud.google.com/endpoints/docs/grpc/transcoding\n[http-handler]: https://pkg.go.dev/net/http#Handler\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericchiang%2Fgrpc-http-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericchiang%2Fgrpc-http-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericchiang%2Fgrpc-http-go/lists"}