Documentation
¶
Index ¶
- func ParamFromContext(ctx context.Context, key string) string
- func WildcardsFromContext(ctx context.Context) []string
- type Logger
- type Router
- func (r *Router) CONNECT(path string, handler http.Handler)
- 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) Handle(method, path string, handler http.Handler)
- func (r *Router) HandleFunc(method, path string, handler func(http.ResponseWriter, *http.Request))
- 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) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) TRACE(path string, handler http.Handler)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParamFromContext ¶
ParamFromContext gets URL parameters from reqeust context.Context.
func WildcardsFromContext ¶
WildcardsFromContext gets URL wildcard parameters from reqeust context.Context.
Types ¶
type Logger ¶
type Logger interface {
Printf(format string, v ...interface{})
}
Logger interface represents error logger.
This package needs to log error on ServeHTTP. So this interface is used for that.
type Router ¶
type Router struct { // ErrorLog logs error in ServeHTTP. If not specified, it defaults // to log.Printf is used. ErrorLog Logger // NotFound is configurable http.Handler which is called when no matching // route is found. If it is not set, http.NotFound is used. NotFound http.Handler // contains filtered or unexported fields }
Router is a http.Handler which can be used to dispatch requests to different handler functions via configurable routes
func (*Router) HandleFunc ¶
HandleFunc handles http.HandlerFunc
Click to show internal directories.
Click to hide internal directories.