forked from grpc-ecosystem/grpc-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add README.md for examples (grpc-ecosystem#645)
* Create README.md Add a README.md file to help begginers to start more quickly. I think it may help. * Update README.md
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# One way to run the example | ||
|
||
```bash | ||
# Handle dependencies | ||
$ dep init | ||
``` | ||
|
||
Follow the guides from this [README.md](./browser/README.md) to run the server and gateway. | ||
```bash | ||
# Make sure you are in the correct directory: | ||
# $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/examples | ||
$ cd examples/browser | ||
$ pwd | ||
|
||
# Install gulp | ||
$ npm install -g gulp-cli | ||
$ npm install | ||
$ gulp | ||
|
||
# Run | ||
$ gulp bower | ||
$ gulp backends | ||
``` | ||
|
||
Then you can use curl or a browser to test: | ||
|
||
```bash | ||
# List all apis | ||
$ curl http://localhost:8080/swagger/echo_service.swagger.json | ||
|
||
# Visit the apis | ||
$ curl -XPOST http://localhost:8080/v1/example/echo/foo | ||
{"id":"foo"} | ||
|
||
$ curl http://localhost:8080/v1/example/echo/foo/123 | ||
{"id":"foo","num":"123"} | ||
|
||
``` | ||
|
||
So you have visited the apis by HTTP successfully. You can also try other apis. |