I’ve been using gRPC and Go a lot in the last year. At Cognitive Logic every one of our backend services is implemented with Go and gRPC, and it enables us to abstract away most of the complexities of networked micro services and keep interfaces typed and well defined using Google protobuffers.
Naturally, I want to be able to use Go and gRPC in the backend as well if I can, and with the use of the gRPC HTTP Gateway it becomes as simple as writing a normal gRPC service.
So what are the steps required to get a GopherJS frontend client talking to a gRPC backend seamlessly? In short:
If you want to skip ahead, the finished example can be found on my github.
Some structure will help organization. Let’s create a
$ tree -L 1 -d . |-- client |-- protos `-- server
Next up we’ll create the proto interface.