This is a gRPC implementation of simple math tasks.
Table of Contents
An example gRPC calculator usage could look like the following. By running the server in a first shell user will be notified, that it is serving and waiting for calls from client. By starting the client in the second shell window, user will be prompted to enter a simple equation, f.e 1 + 2
. All allowed operations are +
, -
,*
and /
.
-
Install dependencies
go mod download
-
In the first shell, start the server
gServer.go
go run gServer.go
-
In the second shell, start the client
gClient.go
go run gClient.go
-
Input some math operation
1 + 1
1000 / 13
1000 * 13
For tests execution:
go test
To atumate the tests on every commit was added a Github Actions workflow.
to run the server as a Dockerfile:
-
Build the Dockerfile:
docker build -t server -f server/Dockerfile .
-
Run the container
docker run -d -p 8080:8080 server
-
Run the client.
go run clien/gClient.go
Made according to this description
-
Create network
docker network create --driver bridge go-net
-
Build and run the server. It is important to provide here a name for the server, so the client knows to whom he has to speak
docker build -t server -f server/Dockerfile . docker run -d --network go-net --name server server
-
Build and run the client via a shell script, that simulates a simple input.
docker build -t client -f client/Dockerfile . docker run -i --log-driver=none -a stdin -a stdout -a stderr --network go-net -p 8080:8080 client
- parsing complex strings
- implementing additional math equations
- ✅ error handling