Issue
I have worked with grpc .net client and a grpc server created with java, how can i implement grpc web client on angular 6 with typescript? Also how can i create proto files and it’s typing’s for typescript?
I am following this repo but not able to generate proto files.
Solution
After spending sometime i was able to create proto files for typescript by following steps:
- Download protobuf for windows from this link. After extracting files set the path variable for protoc.exe
- install npm packages
npm install google-protobuf @types/google-protobuf grpc-web-client ts-protoc-gen --save
- After installing it generate the typescript files by using the command:
protoc --plugin="protoc-gen-ts=absolute-path-to-your-project\node_modules\.bin\protoc-gen-ts.cmd" --js_out="import_style=commonjs,binary:${OUT_DIR}" --ts_out="service=true:${OUT_DIR}" your.proto
- Finally consume it like as mentioned in this repo.