/js-protobuf-example

Simple protocol buffers example written in JavaScript.

Primary LanguageJavaScriptMIT LicenseMIT

JavaScript protocol buffers example

Simple protocol buffers example written in JavaScript.

Requirements

  • Node.js and npm
  • protoc

Installation

  npm install

Usage

First you have to generate the JavaScript classes from the .proto file:

  protoc \
    --proto_path=protocol_buffers/definitions \
    --js_out=import_style=commonjs,binary:protocol_buffers/messages \
    protocol_buffers/definitions/person.proto

Now you can use the generated getters, setters and methods for the serialization. Run index.js for the example:

  node index.js

Testing

Run JSHint checks:

  docker-compose run js-tools jshint index.js

Run JSCS checks:

  docker-compose run js-tools jscs index.js

License

This project is licensed under the terms of the MIT License (MIT).