Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithEndpoint ¶
func WithEndpoint(e *Endpoint) server.HandlerOption
WithEndpoint returns a server.HandlerOption with endpoint metadata set
Usage:
proto.RegisterHandler(service.Server(), new(Handler), api.WithEndpoint( &api.Endpoint{ Name: "Greeter.Hello", Path: []string{"/greeter"}, }, ))
Types ¶
type Api ¶
type Api interface { // Initialise options Init(...Option) error // Get the options Options() Options // Register a http handler Register(*Endpoint) error // Register a route Deregister(*Endpoint) error // Implementation of api String() string }
nolint: revive Api interface
type Endpoint ¶
type Endpoint struct { // Name Greeter.Hello Name string // Desciption for endpoint Description string // Handler e.g rpc, proxy Handler string // Body destination // "*" or "" - top level message value // "string" - inner message value Body string // Host e.g example.com Host []string // Method e.g GET, POST Method []string // Path e.g /greeter. Expect POSIX regex Path []string // Stream flag Stream bool }
Endpoint is a mapping between an RPC method and HTTP endpoint
Click to show internal directories.
Click to hide internal directories.