Example Project GRPC + .Net + grpc-proxy + Reactjs
Restore and starting the grpc-server and proxy with the following commands:
npm i
npm run restore-all
npm run start-macos # According your os start-linux, start-windows
Starting the grpc-client with the following command:
npm run start-client
- .Net Core 2.0
- Nodejs
- Java (Swagger -> Typescript Generation)
- Go (grpc-proxy compilation)
- Protoc (required binaries already in the repo)
<PackageReference Include="Google.Protobuf" Version="3.5.1" />
<PackageReference Include="Grpc.Core" Version="1.10.0" />
<PackageReference Include="Grpc.Tools" Version="1.10.0" />
protoc --csharp_out=grpc-service --grpc_out=grpc-service --plugin=protoc-gen-grpc=grpc_csharp_plugin ./protobuf/todo.proto
Requirments:
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go
# Service generation
../tools/macosx_x64/protoc -I ./protobuf --go_out=plugins=grpc:./grpc-proxy/grpcproxy ./protobuf/todo.proto
# Proxy Gateway generation
../tools/macosx_x64/protoc -I ./protobuf --grpc-gateway_out=logtostderr=true:./grpc-proxy/grpcproxy ./protobuf/todo.proto
# Swagger generation
../tools/macosx_x64/protoc -I ./protobuf --swagger_out=logtostderr=true:./grpc-proxy ./protobuf/todo.proto
java -jar ./tools/swagger-codegen-cli-2.2.1.jar generate -i ./src/grpc-proxy/proxy.swagger.json -l typescript-fetch -o temp
Copy the api.ts
from ./temp
to ./src/webapp/api
and add line /* tslint:disable */
at the top of the file.