protoc-gen-twirp_js

command module
v0.0.0-...-0fe8731 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2019 License: MIT Imports: 13 Imported by: 0

README

protoc-gen-twirp_js

Creates javascript bindings compatible with both the browser and node.js as common-js modules. This means that you should run your protoc with options for the --js-out as --js-out=import_style=commonjs,binary:<path>.

The resulting javascript files <service>_pb.js and <service>_pb_twirp.js will be compatible with all commonjs aware module systems, for example, nodejs, browserify, webpack, rollup, etc...

Caveats

  1. I am not completely happy with the JSON support, I do not believe that the serialisation the Google PB JS output provides matches the protocol buffers JSON serialisation definition. Nor does the other prominent alternative dcodeIO/protobuf.js, which leaves implementing it myself, and then probably the entire generator, or not bothering. Given there is little incentive to actually use JSON on the wire, I lean towards removing/ignoring the JSON interop - this library deals with plain objects either way, only the wire format changes.
  2. Twirp is adding Streaming support. I don't really want to implement that. The simplicity of the RPC (in contrast to grpc for example) was a major selling point to me.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
gen

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL