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.Register(server, handler, api.WithEndpoint(&Endpoint{Name: "Greeter.Hello", Path: []string{"/greeter"}}))
Types ¶
type Endpoint ¶
type Endpoint struct { // RPC Method e.g. Greeter.Hello Name string // Description e.g what's this endpoint for Description string // API Handler e.g rpc, proxy Handler Handler // HTTP Host e.g example.com Host []string // HTTP Methods e.g GET, POST Method []string // HTTP Path e.g /greeter. Expect POSIX regex Path []string }
Endpoint is a mapping between an RPC method and HTTP endpoint
type Handler ¶
type Handler string
Handler defines the type of handler uses by the micro api
const ( // Default defines the default handler Default Handler = "meta" // serves api.Request and api.Response Api Handler = "api" // serves the async api.Event handler Event Handler = "event" // forwards as http request Http Handler = "http" // proxies a http request Proxy Handler = "proxy" // services an RPC request/response Rpc Handler = "rpc" // serves the web proxy handler Web Handler = "web" )
Directories ¶
Path | Synopsis |
---|---|
Package handler provides http handlers
|
Package handler provides http handlers |
web
Package web contains the web handler including websocket support
|
Package web contains the web handler including websocket support |
internal
|
|
Package go_api is a generated protocol buffer package.
|
Package go_api is a generated protocol buffer package. |
Package router provides api service routing
|
Package router provides api service routing |
Package server provides a http server with features; acme, cors, etc
|
Package server provides a http server with features; acme, cors, etc |
Click to show internal directories.
Click to hide internal directories.