From 9c44bc84b7891690eeb93d9bb390ff849a42f512 Mon Sep 17 00:00:00 2001 From: Kun Liu Date: Wed, 9 May 2018 00:37:18 +0800 Subject: [PATCH] Add README.md for examples (#645) * Create README.md Add a README.md file to help begginers to start more quickly. I think it may help. * Update README.md --- examples/README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 examples/README.md diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000000..b7b486f244f --- /dev/null +++ b/examples/README.md @@ -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.