Skip to content
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

37 lines (32 sloc) 893 Bytes
Command example-gateway-server is an example reverse-proxy implementation
whose HTTP handler is generated by grpc-gateway.
package main
import (
var (
endpoint = flag.String("endpoint", "localhost:9090", "endpoint of the gRPC service")
network = flag.String("network", "tcp", `one of "tcp" or "unix". Must be consistent to -endpoint`)
swaggerDir = flag.String("swagger_dir", "examples/proto/examplepb", "path to the directory which contains swagger definitions")
func main() {
defer glog.Flush()
ctx := context.Background()
opts := gateway.Options{
Addr: ":8080",
GRPCServer: gateway.Endpoint{
Network: *network,
Addr: *endpoint,
SwaggerDir: *swaggerDir,
if err := gateway.Run(ctx, opts); err != nil {
You can’t perform that action at this time.