protoc. The story exposed some limitations and tradeoffs inherent to that approach, the most salient of which was the need to manually create marshalling code for each request and response.
You can create a gRPC server in Node.js with static code generation, but with tradeoffs that you should understand. In the previous story in this series, I explained the ecosystem of gRPC tooling for Node.js. Now I’ll show you how to build a statically-generated server using those tools.
We’ll use the tools to build a simple sample application. This application provides a service that models a library filled with books. Its methods allow retrieving all of the books and checking out a book. All the code I’ll share can be found here.
One would expect a slick, straightforward integration between Node.js and gRPC — they’re both Google’s progeny, after all. That’s sadly not the case. It’s complicated. At Vrbo™ (part of Expedia Group™), I’ve learned about this ecosystem and can help you understand the tooling landscape, learn how to use the tools, and see what kind of code you can expect from each. And steer clear of some pitfalls.