Documentation ¶
Index ¶
- Variables
- func Param(ctx context.Context, key string) string
- type Router
- func (r *Router) Delete(path string, handler http.Handler)
- func (r *Router) Get(path string, handler http.Handler)
- func (r *Router) Head(path string, handler http.Handler)
- func (r *Router) Options(path string, handler http.Handler)
- func (r *Router) Patch(path string, handler http.Handler)
- func (r *Router) Post(path string, handler http.Handler)
- func (r *Router) Put(path string, handler http.Handler)
- func (r *Router) Route(path string, handler http.Handler)
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) Use(middleware ...func(http.Handler) http.Handler)
- type RouterParam
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnknownHTTPMethod = errors.New("unknown or unsupported http method") ErrNilHandler = errors.New("nil handler cannot be assigned") ErrAlreadyAssigned = errors.New("cannot reassign handler") ErrAssignment = errors.New("cannot assign child/leaf to node") ErrNoHandler = errors.New("no handler for http method assigned") )
Functions ¶
Types ¶
type Router ¶
type Router struct { // 404 and 500 handler which called if no handler for route assigned or error occurs NotFoundHandler http.Handler // contains filtered or unexported fields }
Router struct represents router instance which implements the http.Handler interface
func (*Router) Route ¶
Route assigns the given handler for given path, if route is called the request is passed through this handler Used for sub-routing, path will be stripped through http.StripPrefix middleware before request passed to handler
type RouterParam ¶
RouterParam map[string]string holds the parameter from each route if set
Click to show internal directories.
Click to hide internal directories.