{"id":15518065,"url":"https://github.com/iamrajiv/basic-arithmetic-grpc-server","last_synced_at":"2025-10-04T02:33:36.640Z","repository":{"id":38823162,"uuid":"321020732","full_name":"iamrajiv/basic-arithmetic-grpc-server","owner":"iamrajiv","description":"This is a gRPC server project that uses gRPC-Gateway to create a reverse-proxy server. It uses protobuf service definitions and provides basic arithmetic operations, such as addition, division, multiplication, and subtraction, for two integers.","archived":false,"fork":false,"pushed_at":"2023-05-06T08:00:16.000Z","size":126,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T04:05:36.596Z","etag":null,"topics":["go","grpc","grpc-gateway","protobuf","rest"],"latest_commit_sha":null,"homepage":"https://app.swaggerhub.com/apis/iamrajiv/Basic_Arithmetic_gRPC_Server/2","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamrajiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yaml","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},"funding":{"github":"iamrajiv","custom":"https://www.buymeacoffee.com/iamrajiv"}},"created_at":"2020-12-13T08:44:38.000Z","updated_at":"2023-09-06T02:46:30.000Z","dependencies_parsed_at":"2025-03-05T04:41:50.123Z","dependency_job_id":null,"html_url":"https://github.com/iamrajiv/basic-arithmetic-grpc-server","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/iamrajiv%2Fbasic-arithmetic-grpc-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamrajiv%2Fbasic-arithmetic-grpc-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamrajiv%2Fbasic-arithmetic-grpc-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamrajiv%2Fbasic-arithmetic-grpc-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamrajiv","download_url":"https://codeload.github.com/iamrajiv/basic-arithmetic-grpc-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250366726,"owners_count":21418771,"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":["go","grpc","grpc-gateway","protobuf","rest"],"created_at":"2024-10-02T10:14:50.367Z","updated_at":"2025-10-04T02:33:36.549Z","avatar_url":"https://github.com/iamrajiv.png","language":"Go","funding_links":["https://github.com/sponsors/iamrajiv","https://www.buymeacoffee.com/iamrajiv"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"assets/basic-arithmetic-grpc-server.svg\" height=\"auto\" width=\"400\" /\u003e\n\u003cbr /\u003e\n\u003ch1\u003eBasic Arithmetic gRPC Server\u003c/h1\u003e\n\u003cp\u003e\nSimple basic arithmetic gRPC server which uses gRPC-Gateway\n\u003c/p\u003e\n\u003ca href=\"https://github.com/iamrajiv/basic-arithmetic-grpc-server/network/members\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/iamrajiv/basic-arithmetic-grpc-server?color=0969da\u0026style=for-the-badge\" height=\"auto\" width=\"auto\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/iamrajiv/basic-arithmetic-grpc-server/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/iamrajiv/basic-arithmetic-grpc-server?color=0969da\u0026style=for-the-badge\" height=\"auto\" width=\"auto\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/iamrajiv/basic-arithmetic-grpc-server/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/iamrajiv/basic-arithmetic-grpc-server?color=0969da\u0026style=for-the-badge\" height=\"auto\" width=\"auto\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n## About\n\nThis is a gRPC server project that uses gRPC-Gateway to create a reverse-proxy server. It uses protobuf service definitions and provides basic arithmetic operations, such as addition, division, multiplication, and subtraction, for two integers.\n\nFor additional resources on gRPC-Gateway, take a look at [Hello World gRPC-Gateway](https://github.com/iamrajiv/helloworld-grpc-gateway), a basic program that employs gRPC-Gateway. I developed this project while contributing to [gRPC-Gateway](https://github.com/grpc-ecosystem/grpc-gateway) during [Google Season of Docs 2020](https://github.com/iamrajiv/GSoD-2020) to help people become familiar with the framework.\n\nAll the tutorials related to Hello World gRPC-Gateway have been added to the [gRPC-Gateway documentation website](https://grpc-ecosystem.github.io/grpc-gateway/docs/tutorials/).\n\nThe folder structure of the project is as follows:\n\n```shell\n.\n├── LICENSE\n├── Makefile\n├── README.md\n├── assets\n│   └── basic-arithmetic-grpc-server.svg\n├── buf.gen.yaml\n├── buf.yaml\n├── go.mod\n├── go.sum\n├── main.go\n└── proto\n    ├── arithmetic\n    │   ├── arithmetic.pb.go\n    │   ├── arithmetic.pb.gw.go\n    │   ├── arithmetic.proto\n    │   ├── arithmetic.swagger.json\n    │   └── arithmetic_grpc.pb.go\n    └── google\n        └── api\n            ├── annotations.proto\n            └── http.proto\n```\n\n## Usage\n\n#### Installation\n\nBefore running this project, we need to install the required Go packages. To do this, run the following command:\n\n```shell\nmake install\n```\n\n#### Generating stubs\n\nWe can generate the stubs for the project using the following command:\n\n```shell\nmake generate\n```\n\n#### Cleaning stubs\n\nTo delete the stubs, use the following command:\n\n```shell\nmake clean\n```\n\n#### Running the server\n\nTo run the server, use the following command:\n\n```shell\ngo run main.go\n```\n\n#### Sending HTTP Requests\n\nTo send an HTTP POST request to the server, use cURL with the following command:\n\n\u003e Please note that the project only supports fundamental arithmetic operations, including addition, division, multiplication, and subtraction. However, these operations are exclusively intended for integer values and do not support non-integer values.\n\nFor `/v1/arithmetic/add` endpoint:\n\n```shell\ncurl -k  -X POST \"http://localhost:8090/v1/arithmetic/add\" -H  \"accept: application/json\" -H  \"Content-Type: application/json\" -d \"{  \\\"a\\\": \\\"15\\\",  \\\"b\\\": \\\"17\\\"}\"\n```\n\nThe server will respond with the following message:\n\n```shell\n{\"result\":\"32\"}\n```\n\nFor `/v1/arithmetic/sub` endpoint:\n\n```shell\ncurl -k  -X POST \"http://localhost:8090/v1/arithmetic/sub\" -H  \"accept: application/json\" -H  \"Content-Type: application/json\" -d \"{  \\\"a\\\": \\\"15\\\",  \\\"b\\\": \\\"17\\\"}\"\n```\n\nThe server will respond with the following message:\n\n```shell\n{\"result\":\"-2\"}\n```\n\nFor `/v1/arithmetic/mul` endpoint:\n\n```shell\ncurl -k  -X POST \"http://localhost:8090/v1/arithmetic/mul\" -H  \"accept: application/json\" -H  \"Content-Type: application/json\" -d \"{  \\\"a\\\": \\\"15\\\",  \\\"b\\\": \\\"17\\\"}\"\n```\n\nThe server will respond with the following message:\n\n```shell\n{\"result\":\"255\"}\n```\n\nFor `/v1/arithmetic/div` endpoint:\n\n```shell\ncurl -k  -X POST \"http://localhost:8090/v1/arithmetic/div\" -H  \"accept: application/json\" -H  \"Content-Type: application/json\" -d \"{  \\\"a\\\": \\\"15\\\",  \\\"b\\\": \\\"3\\\"}\"\n```\n\nThe server will respond with the following message:\n\n```shell\n{\"result\":\"5\"}\n```\n\n## Swagger UI\n\nWe can view and test the API using the Swagger UI at the following link: [https://app.swaggerhub.com/apis/iamrajiv/Basic_Arithmetic_gRPC_Server/2](https://app.swaggerhub.com/apis/iamrajiv/Basic_Arithmetic_gRPC_Server/2).\n\n## License\n\n[MIT](https://github.com/iamrajiv/basic-arithmetic-grpc-server/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamrajiv%2Fbasic-arithmetic-grpc-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamrajiv%2Fbasic-arithmetic-grpc-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamrajiv%2Fbasic-arithmetic-grpc-server/lists"}