grpc-vuex
grpc-vuex
JavaScript (Vuex) code generator with grpc-web
Install
npm i -g grpc-vuex or yarn global add grpc-vuex
Dependencies (Required!)
protoc
http://google.github.io/proto-lens/installing-protoc.html
protoc-gen-grpc-web
https://github.com/grpc/grpc-web#code-generator-plugin
Run
grpc-vuex <output_file_path> <proto_file_paths ...>
Command Options
grpc-vuex -h
Example
grpc-vuex output.js helloworld.proto --endpoint https://yourdomain.com
helloworld.proto
syntax = "proto3";
package helloworld;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply);
}
message User {
string name = 1;
int32 age = 2;
repeated string children = 3;
}
message HelloRequest {
repeated User users = 1;
}
message HelloReply {
repeated User users = 1;
}
output.d.ts
interface User {
name?:string;
age?:number;
children?:string[];
}
interface HelloRequest {
users?:User[];
}
interface HelloReply {
users?:User[];
}
export function sayHello(param:HelloRequest):Promise<HelloReply>;
output.js
(omitted)
In your JS code
import { sayHello } from './output'
sayHello({
users: [
{
name: 'foobar',
age: '99',
children: ['john', 'mike']
}
]
}).then((res)=>console.log(res))
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 0.21.0 | MIT | |
| 0.20.2 | MIT | |
| 0.20.1 | MIT | |
| 0.20.0 | MIT | |
| 0.19.0 | MIT | |
| 0.18.1 | MIT | |
| 0.18.0 | MIT | |
| 0.17.1 | MIT | |
| 0.17.0 | MIT | |
| 0.16.0 | MIT | |
| 0.15.0 | MIT | |
| 0.14.2 | MIT | |
| 0.14.1 | MIT | |
| 0.14.0 | MIT | |
| 0.13.1 | MIT | |
| 0.13.0 | MIT | |
| 0.12.1 | MIT | |
| 0.12.0 | MIT | |
| 0.11.2 | MIT | |
| 0.11.1 | MIT | |
| 0.11.0 | MIT | |
| 0.10.0 | MIT | |
| 0.9.10 | MIT | |
| 0.9.9 | MIT | |
| 0.9.8 | MIT | |
| 0.9.7 | MIT | |
| 0.9.6 | MIT | |
| 0.9.5 | MIT | |
| 0.9.4 | MIT | |
| 0.9.3 | MIT |
Showing the latest 30 of 60. See every release on npm