diff --git a/README.md b/README.md index 08f70ce00..5cc9ffcf3 100644 --- a/README.md +++ b/README.md @@ -323,4 +323,8 @@ delete_local_copy: true delete_cloud_copy: true -``` \ No newline at end of file +``` + +### Documentation + +GRPC related documentation can be found [here](./code/go/0chain.net/blobbercore/blobbergrpc/README.md). \ No newline at end of file diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/README.md b/code/go/0chain.net/blobbercore/blobbergrpc/README.md index b46217165..d45b4a594 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/README.md +++ b/code/go/0chain.net/blobbercore/blobbergrpc/README.md @@ -1,19 +1,46 @@ -# GRPC Migration +# GRPC Endpoints + +## Development Modify the '.proto' file in `code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto` and run `scripts/generate-grpc.sh` to add new api's. GRPC API is implemented in `code/go/0chain.net/blobbercore/handler/grpc_handler.go`. +## Installation + +Install the [protoc](https://grpc.io/docs/protoc-installation/) command line interface. + +``` +go install \ +github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \ +github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \ +google.golang.org/protobuf/cmd/protoc-gen-go \ +google.golang.org/grpc/cmd/protoc-gen-go-grpc +``` + +Run this command to install all the GRPC related binaries required to generate GRPC related files using `protoc` CLI. + +Now you can run the script in `scripts/generate-grpc.sh`. + ## Plugins + * [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway) plugin is being used to expose a REST api for grpc incompatible clients. -## Interacting with the api +## Testing + The current grpc implementation supports server reflection in development environment. You can interact with the api using https://github.com/gusaul/grpcox. Make sure the server is running on `--deployment_mode 0` to use server reflection. -## Dealing with paths -Refer to - https://developers.google.com/protocol-buffers/docs/reference/go-generated \ No newline at end of file +You can use https://github.com/vektra/mockery to generate mocks for tests. + +## Documentation + +Basic documentation can be found here - https://grpc.io/docs/languages/go/basics/. + +Advanced documentation can be found here - https://github.com/grpc/grpc-go/tree/master/Documentation. + +