grpc-gateway
Running
Running main.go
starts a web server on https://0.0.0.0:11000/. You can configure
the port used with the $PORT
environment variable, and to serve on HTTP set
$SERVE_HTTP=true
.
$ go run main.go
An OpenAPI UI is served on https://0.0.0.0:11000/.
Running the standalone server
If you want to use a separate gRPC server, for example one written in Java or C++, you can run the
standalone web server instead:
$ go run ./cmd/standalone/ --server-address dns:///0.0.0.0:10000
Requirements
Generating the files requires the protoc
protobuf compiler.
Please install it according to the
installation instructions
for your specific platform.
Generating Files
After changing proto files, regenerate the files using
make generate
. This will mean you'll need to implement any functions in
server/server.go
, or else the build will fail since your struct won't
be implementing the interface defined by the generated file in proto/example.pb.go
.
This should hopefully be all you need to get started playing around with the gRPC-Gateway!