Skip to content

Latest commit

 

History

History
109 lines (76 loc) · 3.97 KB

README.md

File metadata and controls

109 lines (76 loc) · 3.97 KB

gRPC Golang Project

Welcome to the grpc-golang_master repository! This project demonstrates how to implement gRPC services in Go. The repository is organized into several branches, each representing a different feature or functionality. Below is a guide to each branch, describing its unique purpose.

Branch Overview

1. main

  • Purpose: This is the primary branch for the project. It contains the main codebase and is typically the most stable version of the project.
  • What to expect:
    • Core gRPC server and client implementation.
    • Default settings and configurations.
    • The most tested and up-to-date version of the code.

To get started, you can clone the repository and checkout the main branch:

git checkout main
2. calculator
Purpose: This branch demonstrates how to build a simple calculator service using gRPC.
What to expect:
A CalculatorService that provides basic arithmetic operations (addition, subtraction, multiplication, division) via gRPC.
Example request and response structures for each operation.
To explore this branch:


git checkout calculator
3. crud-api_mongodb
Purpose: This branch demonstrates how to create a CRUD API that interacts with a MongoDB database via gRPC.
What to expect:
Implementation of CRUD operations (Create, Read, Update, Delete) exposed via gRPC.
Integration with MongoDB for storing data.
Example messages and gRPC service definitions for handling CRUD operations.
To try it out:


git checkout crud-api_mongodb
Make sure you have MongoDB running, and configure the necessary environment variables (e.g., MongoDB URI).

4. greet-streaming
Purpose: This branch showcases how to implement server-side streaming using gRPC.
What to expect:
A GreetService that supports server-streaming, sending multiple responses for a single request.
Use cases where a client receives a continuous stream of responses (e.g., sending progress updates or real-time data).
To explore server-streaming functionality:


git checkout greet-streaming
5. server-streaming
Purpose: This branch demonstrates how to implement server-streaming in gRPC.
What to expect:
A service that streams multiple responses to a client. Ideal for long-running queries or real-time notifications.
Example of a StreamMessages RPC that streams messages to the client.
To explore the server-streaming functionality:


git checkout server-streaming
6. setup
Purpose: This branch contains the initial setup scripts, configuration files, and documentation for setting up the project.
What to expect:
Instructions for setting up gRPC with Go and necessary dependencies.
Setup scripts that help you get the project running quickly.
Example configurations for local development.
To view the setup guide:


git checkout setup
7. withoutgeneratedcode
Purpose: This branch demonstrates how the project looks without the generated code from .proto files.
What to expect:
The raw .proto files without the Go code generated by protoc.
Useful for understanding how the .proto files are structured and how the code is generated.
To explore this branch:


git checkout withoutgeneratedcode
How to Run the Project
To run any of the branches locally, follow these steps:

Clone the repository:


git clone https://github.com/ArjunDev17/grpc-golang_master.git
cd grpc-golang_master
Install dependencies:

Ensure you have Go and protoc installed. You may need to install the Go plugins for protoc:


go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
Switch to the branch you want to work with:


git checkout <branch-name>
Generate the Go code from .proto files:


make greet  # or the specific Makefile target for your branch
Run the server:


go run server.go
Run the client (if applicable):


go run client.go
Contribution
If you'd like to contribute to this project, feel free to fork the repository and submit pull requests for any improvements or bug fixes. When submitting a pull request, please make sure to follow the project's code style and conventions.