Documentation
¶
Index ¶
- func GetValue(req *http.Request, variable string) string
- func SplitInTwo(str string, sep string) (string, string)
- type ErrorStatusCode
- type Mux
- func (mux *Mux) CaseSensitive(cs bool) *Mux
- func (mux *Mux) Connect(path string, handler http.Handler) *Route
- func (mux *Mux) ConnectFunc(path string, handler http.HandlerFunc) *Route
- func (mux *Mux) DefaultServe(rw http.ResponseWriter, req *http.Request)
- func (mux *Mux) Delete(path string, handler http.Handler) *Route
- func (mux *Mux) DeleteFunc(path string, handler http.HandlerFunc) *Route
- func (mux *Mux) Get(path string, handler http.Handler) *Route
- func (mux *Mux) GetFunc(path string, handler http.HandlerFunc) *Route
- func (mux *Mux) Handle(path string, handler http.Handler)
- func (mux *Mux) HandleFunc(path string, handler http.HandlerFunc)
- func (mux *Mux) Head(path string, handler http.Handler) *Route
- func (mux *Mux) HeadFunc(path string, handler http.HandlerFunc) *Route
- func (mux *Mux) ListenAndServe(port string) error
- func (mux *Mux) NotFound(handler http.Handler)
- func (mux *Mux) NotFoundFunc(handlerFunc http.HandlerFunc)
- func (mux *Mux) Options(path string, handler http.Handler) *Route
- func (mux *Mux) OptionsFunc(path string, handler http.HandlerFunc) *Route
- func (mux *Mux) Patch(path string, handler http.Handler) *Route
- func (mux *Mux) PatchFunc(path string, handler http.HandlerFunc) *Route
- func (mux *Mux) Post(path string, handler http.Handler) *Route
- func (mux *Mux) PostFunc(path string, handler http.HandlerFunc) *Route
- func (mux *Mux) Prefix(prefix string) *Mux
- func (mux *Mux) Put(path string, handler http.Handler) *Route
- func (mux *Mux) PutFunc(path string, handler http.HandlerFunc) *Route
- func (mux *Mux) Register(method string, path string, handler http.Handler) *Route
- func (mux *Mux) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (mux *Mux) Trace(path string, handler http.Handler) *Route
- func (mux *Mux) TraceFunc(path string, handler http.HandlerFunc) *Route
- type Route
- type RouteTrie
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorStatusCode ¶
type ErrorStatusCode struct {
HttpStatus int
}
ErrorStatusCode is used to signal for HTTP Error Status Codes
type Mux ¶
type Mux struct {
Routes *RouteTrie
Serve func(rw http.ResponseWriter, req *http.Request)
// contains filtered or unexported fields
}
Mux have routes, notFound (404 status code) handler and Serve which serves incoming requests Routes: all the registered routes notFound: 404 status code handler, default: http.NotFound CaseSensitive: for routes to be case sensitive or not, default false
func (*Mux) CaseSensitive ¶
CaseSensitive sets whether routes are case sensitive or not. Default being false
func (*Mux) ConnectFunc ¶
func (mux *Mux) ConnectFunc(path string, handler http.HandlerFunc) *Route
ConnectFunc registers route with method CONNECT
func (*Mux) DefaultServe ¶
func (mux *Mux) DefaultServe(rw http.ResponseWriter, req *http.Request)
DefaultServe is the default HTTP request handler
func (*Mux) DeleteFunc ¶
func (mux *Mux) DeleteFunc(path string, handler http.HandlerFunc) *Route
DeleteFunc registers route with method DELETE
func (*Mux) GetFunc ¶
func (mux *Mux) GetFunc(path string, handler http.HandlerFunc) *Route
GetFunc registers route with method GET
func (*Mux) HandleFunc ¶
func (mux *Mux) HandleFunc(path string, handler http.HandlerFunc)
HandleFunc registers route with all the methods
func (*Mux) HeadFunc ¶
func (mux *Mux) HeadFunc(path string, handler http.HandlerFunc) *Route
HeadFunc registers route with method HEAD
func (*Mux) ListenAndServe ¶
ListenAndServe appends ":" in port before calling http.ListenAndServe
func (*Mux) NotFoundFunc ¶
func (mux *Mux) NotFoundFunc(handlerFunc http.HandlerFunc)
NotFoundFunc registers a custom 404 Handler and takes http.HandlerFunc as argument
func (*Mux) OptionsFunc ¶
func (mux *Mux) OptionsFunc(path string, handler http.HandlerFunc) *Route
OptionsFunc registers route with method OPTIONS
func (*Mux) PatchFunc ¶
func (mux *Mux) PatchFunc(path string, handler http.HandlerFunc) *Route
PatchFunc registers route with method PATCH
func (*Mux) PostFunc ¶
func (mux *Mux) PostFunc(path string, handler http.HandlerFunc) *Route
PostFunc registers route with method POST
func (*Mux) PutFunc ¶
func (mux *Mux) PutFunc(path string, handler http.HandlerFunc) *Route
PutFunc registers route with method Put
func (*Mux) ServeHTTP ¶
func (mux *Mux) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP calls the Serve method of Mux for processing
type Route ¶
type Route struct {
Path string
// contains filtered or unexported fields
}
Route contains Path and methods on it is enabled, with Handler to serve request Path: is full path with prefix methods: have value OR'ed for all the methods enabled Handler: has a serving handler for the request
