Documentation ¶
Overview ¶
Package router provides api service routing
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // Register for service lookup Register register.Register // Resolver to use Resolver resolver.Resolver // Logger micro logger Logger logger.Logger // Context is for external options Context context.Context // Handler name Handler string }
Options holds the options for api router
func NewOptions ¶
NewOptions returns options struct filled by opts
type Router ¶
type Router interface { // Returns options Options() Options // Init initialize router Init(...Option) error // Stop the router Close() error // Endpoint returns an api.Service endpoint or an error if it does not exist Endpoint(r *http.Request) (*api.Service, error) // Register endpoint in router Register(ep *api.Endpoint) error // Deregister endpoint from router Deregister(ep *api.Endpoint) error // Route returns an api.Service route Route(r *http.Request) (*api.Service, error) // String representation of router String() string }
Router is used to determine an endpoint for a request
var DefaultRouter Router
DefaultRouter contains default router implementation
Click to show internal directories.
Click to hide internal directories.