stephenh / ts-proto

An idiomatic protobuf generator for TypeScript
Apache License 2.0
2.13k stars 345 forks source link

Update on the Readme or Available Resources? #169

Closed ghost closed 3 years ago

ghost commented 3 years ago

I posted this on StackOverflow because there seems to be no documentation on how to use the generated files from this library: https://stackoverflow.com/questions/64934155/ts-proto-how-to-create-a-service

Are there any resources available for what to do with the generated .ts files from my proto files? I'm just trying to write a simple server and client to test things out.

stephenh commented 3 years ago

Ah sure, that's probably a good idea. For better or worse, ts-proto is currently agnostic about what actual RPC format/service you use. I.e. you can use the messages to do binary grpc-web/proto3 type stuff, binary twirp/http2 type stuff, or JSON/http2 type stuff.

This makes ts-proto useful to users using any of these approaches, but means it's not really out-of-the-box "run ts-proto and you have an insta-client/server".

You could try NestJS, there is a sample in integration/ that has a working ~zero-ish config nestjs example. Pretty sure there is also one for grpc-web.

I don't personally have time/interest in flushing out/specializing ts-proto to default to any given rpc framework, but open to the idea of it (w/o sacrificing ts-protos overall/current general-ness).