Documentation
¶
Overview ¶
Package router provides api service routing
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Endpoint ¶
type Endpoint struct {
// RPC Method e.g. Greeter.Hello
Name string
// What the endpoint is for
Description string
// API Handler e.g rpc, proxy
Handler string
// 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
// Stream flag
Stream bool
}
Endpoint is a mapping between an RPC method and HTTP endpoint.
type Option ¶
type Option func(o *Options)
Option is a helper for a single options.
func WithHandler ¶
func WithRegistry ¶
func WithResolver ¶
type Options ¶
type Options struct {
Handler string
Registry registry.Registry
Resolver resolver.Resolver
Logger logger.Logger
}
Options is a struct of options available.
type Router ¶
type Router interface {
// Returns options
Options() Options
// Register endpoint in router
Register(r *Route) error
// Deregister endpoint from router
Deregister(r *Route) error
// Route returns an api.Service route
Route(r *http.Request) (*Route, error)
// Stop the router
Stop() error
}
Router is used to determine an endpoint for a request.
Click to show internal directories.
Click to hide internal directories.