...

Package gateway

import "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/gateway"
Overview
Index

Overview ▾

Package gateway is an example of gRPC-Gateway server

func Run

func Run(ctx context.Context, opts Options) error

Run starts a HTTP server and blocks while running if successful. The server will be shutdown when "ctx" is canceled.

type Endpoint

Endpoint describes a gRPC endpoint

type Endpoint struct {
    Network, Addr string
}

type Options

Options is a set of options to be passed to Run

type Options struct {
    // Addr is the address to listen
    Addr string

    // GRPCServer defines an endpoint of a gRPC service
    GRPCServer Endpoint

    // OpenAPIDir is a path to a directory from which the server
    // serves OpenAPI specs.
    OpenAPIDir string

    // Mux is a list of options to be passed to the gRPC-Gateway multiplexer
    Mux []gwruntime.ServeMuxOption
}