github.com/grpc-ecosystem/grpc-gateway/v2@v2.19.1/examples/internal/cmd/example-grpc-server/main.go (about)

     1  /*
     2  Command example-grpc-server is an example grpc server
     3  to be called by example-gateway-server.
     4  */
     5  package main
     6  
     7  import (
     8  	"context"
     9  	"flag"
    10  
    11  	"github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/server"
    12  	"google.golang.org/grpc/grpclog"
    13  )
    14  
    15  var (
    16  	addr    = flag.String("addr", ":9090", "endpoint of the gRPC service")
    17  	network = flag.String("network", "tcp", "a valid network type which is consistent to -addr")
    18  )
    19  
    20  func main() {
    21  	flag.Parse()
    22  
    23  	ctx := context.Background()
    24  	if err := server.Run(ctx, *network, *addr); err != nil {
    25  		grpclog.Fatal(err)
    26  	}
    27  }