Skip to content

Commit

Permalink
Correct example codes
Browse files Browse the repository at this point in the history
  • Loading branch information
yugui committed May 5, 2015
1 parent 593bfcc commit 0691d05
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,18 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`.
- rpc Echo(StringMessage) returns (StringMessage) {}
+ rpc Echo(StringMessage) returns (StringMessage) {
+ option (google.api.http) = {
+ path: "/v1/example/echo"
+ method: "POST"
+ post: "/v1/example/echo"
+ body: "*"
+ };
+ }
}
```
3. Generate gRPC stub

```sh
protoc -I/usr/local/include -I. -I$GOPATH/src \
protoc -I/usr/local/include -I. \
-I$GOPATH/src \
-I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \
--go_out=plugins=grpc:. \
path/to/your_service.proto
```
Expand All @@ -91,10 +93,15 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`.

e.g.
```sh
protoc -I/usr/local/include -I. -I$GOPATH/src --ruby_out=. \
protoc -I/usr/local/include -I. \
-I$GOPATH/src \
-I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \
--ruby_out=. \
path/to/your/service_proto

protoc -I/usr/local/include -I. -I$GOPATH/src \
protoc -I/usr/local/include -I. \
-I$GOPATH/src \
-I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \
--plugin=protoc-gen-grpc-ruby=grpc_ruby_plugin \
--grpc-ruby_out=. \
path/to/your/service.proto
Expand All @@ -103,7 +110,9 @@ Make sure that your `$GOPATH/bin` is in your `$PATH`.
5. Generate reverse-proxy

```sh
protoc -I/usr/local/include -I. -I$GOPATH/src \
protoc -I/usr/local/include -I. \
-I$GOPATH/src \
-I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \
--grpc-gateway_out=logtostderr=true:. \
path/to/your_service.proto
```
Expand Down
4 changes: 0 additions & 4 deletions examples/echo_service.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion examples/echo_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ service EchoService {
rpc Echo(SimpleMessage) returns (SimpleMessage) {
option (google.api.http) = {
post: "/v1/example/echo/{id}"
body: "*"
};
}
rpc EchoBody(SimpleMessage) returns (SimpleMessage) {
Expand Down

0 comments on commit 0691d05

Please sign in to comment.