protoc -I/usr/local/include -I. \
-I$GOPATH/src \
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--go_out=plugins=grpc:. \
--grpc-gateway_out=logtostderr=true:. \
booklist/booklist.proto
To compile and run the server, assuming we are in the folder $GOPATH/src/<path_to_repo_root>
, simply:
go run server/server.go
Likewise, to run the client:
go run server/server.go
To call RESTful api:
curl --data "{\"name\":\"Sample Book\",\"author\":\"Sample Author\"}" localhost:8080/add
curl localhost:8080/list