grpc-mocker/README.md

27 lines
350 B
Markdown
Raw Normal View History

2023-02-18 23:28:01 +05:30
## Just tinkering with grpc
### Setup
2023-02-19 00:14:02 +05:30
2023-02-18 23:28:01 +05:30
```
docker-compose up
2023-02-19 00:14:02 +05:30
# add two numbers and get the result
2023-02-18 23:28:01 +05:30
curl localhost:3001/add/3/2
```
### Test mock server
2023-02-19 00:14:02 +05:30
Actually mocking the server for testing...
2023-02-18 23:28:01 +05:30
```
cd ./server
go test
```
2023-02-19 00:14:02 +05:30
2023-02-18 23:28:01 +05:30
### To generate grpc code using protobuf compiler
```sh
2023-02-19 00:14:02 +05:30
cd ./pb
2023-02-18 23:28:01 +05:30
protoc --go_out=. --go-grpc_out=. calc_service.proto
```