{"id":19538212,"url":"https://github.com/hb-chen/gateway","last_synced_at":"2025-04-26T16:30:42.142Z","repository":{"id":45883664,"uuid":"259418535","full_name":"hb-chen/gateway","owner":"hb-chen","description":"gRPC网关，在 grpc-gateway 基础上使用注册中心实现 API 的动态管理，而不是在编译时静态打包","archived":false,"fork":false,"pushed_at":"2023-07-05T21:04:27.000Z","size":119,"stargazers_count":18,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T14:51:12.027Z","etag":null,"topics":["gateway","go-micro","grpc","grpc-gateway","registry"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hb-chen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-04-27T18:31:41.000Z","updated_at":"2024-07-10T03:58:32.000Z","dependencies_parsed_at":"2024-06-19T05:37:56.548Z","dependency_job_id":null,"html_url":"https://github.com/hb-chen/gateway","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hb-chen%2Fgateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hb-chen%2Fgateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hb-chen%2Fgateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hb-chen%2Fgateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hb-chen","download_url":"https://codeload.github.com/hb-chen/gateway/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251017195,"owners_count":21523532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["gateway","go-micro","grpc","grpc-gateway","registry"],"created_at":"2024-11-11T02:32:46.666Z","updated_at":"2025-04-26T16:30:37.133Z","avatar_url":"https://github.com/hb-chen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gateway\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"docs/assets/images/arch.svg\" /\u003e\n\u003c/div\u003e\n\n## Helm install\n\n```\nhelm upgrade --install grpc-gateway ./helm --namespace grpc-gateway --no-hooks\n```\n\n## Example\n\n**网关**\n```shell script\n$ cd cmd\n$ go run main.go --grpc_registry=etcd --server_address=:8080\n```\n\n**gRPC 服务**\n```shell script\n$ cd example/grpc\n$ go run main.go --grpc_registry=etcd\n```\n\n**~~go-micro 的 gRPC 服务~~**\n```shell script\n$ cd example/micro\n$ go run main.go --grpc_registry=etcd\n```\n\ngRPC 服务支持：\n- Codec\n    - `import _ \"github.com/hb-chen/gateway/v2/codec\"`\n    - go-micro 使用 gRPC server 的 Codec() option\n        `grpc.Codec(\"application/grpc+\"+jsonCodec.Name(), jsonCodec),`\n- 注册中心\n    - [github.com/hb-go/grpc-contrib/registry](https://github.com/hb-go/grpc-contrib/tree/master/registry)\n\n**测试接口**\n\n```shell script\n# POST\ncurl -X POST -d '{\"name\":\"hbchen\"}' http://localhost:8080/v1/example/call\n{\"code\":\"0\",\"msg\":\"Hello hbchen\"}\n\n# GET\ncurl http://localhost:8080/v1/example/call/hbchen\n{\"code\":\"0\",\"msg\":\"Hello hbchen\"}\n```\n    \n## Proto 工具\n\n[protoc-gen-hb-grpc](https://github.com/hb-go/grpc-contrib)\n[protoc-gen-hb-grpc-gateway](https://github.com/hb-chen/gateway)\n\n```shell script\n$ go install github.com/hb-go/grpc-contrib/protoc-gen-hb-grpc\n$ go install github.com/hb-chen/gateway/v2/protoc-gen-hb-grpc-gateway \n```\n    \n```shell script\nprotoc --proto_path=.:$GOPATH/src \\\n--go_out=plugins=grpc:. \\\n--hb-grpc-gateway_out=logtostderr=true,grpc_api_configuration=example/proto/gateway.yaml:. \\\n--hb-grpc_out=plugins=desc+registry:. \\\nexample/proto/service.proto\n```\n\n## Ref\n\n- [micro/go-micro](https://github.com/micro/go-micro)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhb-chen%2Fgateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhb-chen%2Fgateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhb-chen%2Fgateway/lists"}