Documentation ¶
Index ¶
- Constants
- Variables
- type FilterFunc
- type Param
- type QueryParam
- type Route
- type Router
- func (router *Router) Add(path string, f func(w http.ResponseWriter, r *http.Request), methods ...string) *Route
- func (router *Router) Delete(path string, f func(w http.ResponseWriter, r *http.Request)) *Route
- func (router *Router) Get(path string, f func(w http.ResponseWriter, r *http.Request)) *Route
- func (router *Router) GetBoolPathParams(id string, r *http.Request) (bool, error)
- func (router *Router) GetBoolQueryParams(id string, r *http.Request) (bool, error)
- func (router *Router) GetFloatPathParams(id string, r *http.Request) (float64, error)
- func (router *Router) GetFloatQueryParams(id string, r *http.Request) (float64, error)
- func (router *Router) GetIntPathParams(id string, r *http.Request) (int, error)
- func (router *Router) GetIntQueryParams(id string, r *http.Request) (int, error)
- func (router *Router) GetPathParams(id string, r *http.Request) (string, error)
- func (router *Router) GetQueryParams(id string, r *http.Request) (string, error)
- func (router *Router) Post(path string, f func(w http.ResponseWriter, r *http.Request)) *Route
- func (router *Router) Put(path string, f func(w http.ResponseWriter, r *http.Request)) *Route
- func (router *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
const ( PathSeparator = "/" GET = "GET" HEAD = "HEAD" POST = "POST" PUT = "PUT" DELETE = "DELETE" OPTIONS = "OPTIONS" TRACE = "TRACE" PATCH = "PATCH" )
Common constants used throughout
Variables ¶
Functions ¶
This section is empty.
Types ¶
type FilterFunc ¶
FilterFunc FuncHandler for with which the Filters need to be defined
type Param ¶
type Param struct {
// contains filtered or unexported fields
}
Param to hold key value
type QueryParam ¶
type QueryParam struct {
// contains filtered or unexported fields
}
QueryParam for the Route configuration
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route base struct to hold the route information
func (*Route) AddAuthenticator ¶
func (route *Route) AddAuthenticator(auth auth.Authenticator) *Route
AddAuthenticator Adding the authenticator filter to the route
func (*Route) AddFilter ¶
func (route *Route) AddFilter(filter ...FilterFunc) *Route
AddFilter Making the Filter Chain in the order of filters being added if f1, f2, f3, finalHandler handlers are added to the filter chain then the order of execution remains f1 -> f2 -> f3 -> finalHandler
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router struct that holds the router configuration
func NewRouter ¶
func NewRouter() *Router
NewRouter registers the new instance of the Turbo Framework
func (*Router) Add ¶
func (router *Router) Add(path string, f func(w http.ResponseWriter, r *http.Request), methods ...string) *Route
Add a turbo handler for one or more HTTP methods.
func (*Router) GetBoolPathParams ¶
GetBoolPathParams fetches the bool path parameters
func (*Router) GetBoolQueryParams ¶
GetBoolQueryParams fetches the boolean query parameters
func (*Router) GetFloatPathParams ¶
GetFloatPathParams fetches the float path parameters
func (*Router) GetFloatQueryParams ¶
GetFloatQueryParams fetches the float query parameters
func (*Router) GetIntPathParams ¶
GetIntPathParams fetches the int path parameters
func (*Router) GetIntQueryParams ¶
GetIntQueryParams fetches the int query parameters
func (*Router) GetPathParams ¶
GetPathParams fetches the path parameters
func (*Router) GetQueryParams ¶
GetQueryParams fetches the query parameters