Documentation ¶
Index ¶
- Variables
- func ConfigHTTPClient(certificate, privateKey, ca string, insecure bool) error
- type Route
- type Router
- func (r *Router) DELETE(ctx context.Context, path string, handle http.HandlerFunc) error
- func (r *Router) GET(ctx context.Context, path string, handle http.HandlerFunc) error
- func (r *Router) GetRoutes(ctx context.Context) (router.Routes, error)
- func (r *Router) HEAD(ctx context.Context, path string, handle http.HandlerFunc) error
- func (r *Router) HandlerFunc(ctx context.Context, method, path string, handler http.HandlerFunc) error
- func (r *Router) OPTIONS(ctx context.Context, path string, handle http.HandlerFunc) error
- func (r *Router) PATCH(ctx context.Context, path string, handle http.HandlerFunc) error
- func (r *Router) POST(ctx context.Context, path string, handle http.HandlerFunc) error
- func (r *Router) PUT(ctx context.Context, path string, handle http.HandlerFunc) error
- func (r *Router) PathExist(path string) bool
- func (r *Router) Paths() (paths []string)
- func (r *Router) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (r *Router) Start(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
View Source
var BodyLimitSize int64 = 1048576
BodyLimitSize is the max request body size.
View Source
var HTTPClient *http.Client
HTTPClient is the http.Client
Functions ¶
func ConfigHTTPClient ¶
ConfigHTTPClient config the http client that is used by do method to access the router.
Types ¶
type Router ¶
type Router struct { // Router name that will handle the request. Router string // URL of the router server. To access the REST service. URL *url.URL // Addrs of the host that code will be running. Addrs string // contains filtered or unexported fields }
Router agregate the methods to interact with the router server and add methods to it.
var DefaultRouter *Router
TODO: Default router client on package level
func (*Router) HandlerFunc ¶
func (r *Router) HandlerFunc(ctx context.Context, method, path string, handler http.HandlerFunc) error
HandlerFunc is a generic method to add a route into the router.
Click to show internal directories.
Click to hide internal directories.