Have a relatively simple helloworld.proto file down below
syntax = "proto3";
package helloworld;
service Greeter { rpc SayHello(HelloRequest) returns (HelloResponse); }
message HelloRequest { string name = 1; }
message HelloResponse { string message = 1; }
When I run protoc --js_out=import_style=commonjs,binary:. .\helloworld.proto it generates a helloworld_pb.js file but it doesn't include my Greeter service nor my SayHello rpc function. Looked around a few other post and also Google's reference (https://developers.google.com/protocol-buffers/docs/reference/overview) and it seems like I need to include a --plugin option but I can't seem to find any. Does anybody have a solution to for this?
The
protocplugin for Node gRPC is distributed in thegrpc-toolsnpm package. That package provides a toolgrpc_tools_node_protocthat is a version ofprotocthat automatically includes the plugin.As described in that package's README, when you run the tool you will also need to use the
--grpc_outargument to control the plugin. The question is taggedgrpc-js, so you will probably want to use thegrpc_jsoption for that argument to generate code that interacts withgrpc-js.