This is a simple Quiz project implemented in Go, using gRPC as the communication framework.
In this example the server provides an API for registering answers to quiz questions and comparing them with historical data. The client, on the other hand, sends requests to the server and handles the responses. This allows users to interact with the Quiz Service from the command line.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Go 1.16 or higher
- gRPC
- Clone the repository:
git clone https://github.com/yourusername/quiz-service.git 
- Navigate to the project directory:
cd quiz-service
- Download the dependencies:
go mod download 
To run the tests, use the following command:
go test ./...The server for this service is implemented in Go. It uses gRPC for communication and provides an API for registering answers to quiz questions and comparing them with historical data.
The server maintains an in-memory array to store the historical data. This data is used when comparing new answers to previous ones.
To run the server, navigate to the server directory and build the application:
cd server
go buildThis will create an executable file in the server directory. You can run this file to start the server:
./serverThe client for this service is a command-line interface (CLI) built using the Cobra library. It connects to the server, retrieves the quiz questions, and sends the user's answers back to the server.
After the answers are sent, the client receives the quiz feedback and then, prints these results to the command line, allowing the user to see how well they did on the quiz as well as how they compare to other quizzers.
To use the client, navigate to the client directory and build the application:
cd client
go buildThis will create an executable file in the client directory. To start the quiz, execute:
./client quizIf you whish to modify the contract, include your changes in the file ./proto/quiz.proto and then generate the binding files.
Please Consider that you may also have to modify the server and client code to include your changes.
You need to have the following tools installed:
- Protocol Buffers compiler (protoc)
- Go plugin for Protocol Buffers (protoc-gen-go)
- Go plugin for gRPC (protoc-gen-go-grpc)
Once you have the necessary tools, navigate to the project's root folder in your terminal and execute the following command:
protoc --go_out=. --go-grpc_out=.  proto/quiz.proto