Documentation
¶
Index ¶
- type Mux
- func (m *Mux) CONNECT(pattern string, h http.HandlerFunc)
- func (m *Mux) DELETE(pattern string, h http.HandlerFunc, mw ...func(http.Handler) http.Handler)
- func (m *Mux) GET(pattern string, h http.HandlerFunc, mw ...func(http.Handler) http.Handler)
- func (m *Mux) Group(fn func(grp *Mux))
- func (m *Mux) HEAD(pattern string, h http.HandlerFunc, mw ...func(http.Handler) http.Handler)
- func (m *Mux) HttpServeMux() *http.ServeMux
- func (m *Mux) OPTIONS(pattern string, h http.HandlerFunc)
- func (m *Mux) PATCH(pattern string, h http.HandlerFunc, mw ...func(http.Handler) http.Handler)
- func (m *Mux) POST(pattern string, h http.HandlerFunc, mw ...func(http.Handler) http.Handler)
- func (m *Mux) PUT(pattern string, h http.HandlerFunc, mw ...func(http.Handler) http.Handler)
- func (m *Mux) PrintRoutes(w io.Writer)
- func (m *Mux) Resource(pattern string, fn func(res *Resource), mw ...func(http.Handler) http.Handler)
- func (m *Mux) RouteList() []string
- func (m *Mux) Serve(cb ServeCB)
- func (m *Mux) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (m *Mux) TRACE(pattern string, h http.HandlerFunc)
- func (m *Mux) Use(h ...func(http.Handler) http.Handler)
- func (m *Mux) With(mw ...func(http.Handler) http.Handler) *Mux
- type Resource
- func (res *Resource) Create(h http.HandlerFunc)
- func (res *Resource) CreateView(h http.HandlerFunc)
- func (res *Resource) Delete(h http.HandlerFunc)
- func (res *Resource) HandleDELETE(pattern string, h http.HandlerFunc)
- func (res *Resource) HandleGET(pattern string, h http.HandlerFunc)
- func (res *Resource) HandlePATCH(pattern string, h http.HandlerFunc)
- func (res *Resource) HandlePOST(pattern string, h http.HandlerFunc)
- func (res *Resource) HandlePUT(pattern string, h http.HandlerFunc)
- func (res *Resource) Index(h http.HandlerFunc)
- func (res *Resource) Update(h http.HandlerFunc)
- func (res *Resource) UpdatePartial(h http.HandlerFunc)
- func (res *Resource) Use(middlewares ...func(http.Handler) http.Handler)
- func (res *Resource) View(h http.HandlerFunc)
- type RouteList
- type ServeCB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mux ¶ added in v0.5.0
Mux is a wrapper around the go's standard http.ServeMux. It's a lean wrapper with methods to make routing easier
func (*Mux) CONNECT ¶ added in v0.5.0
func (m *Mux) CONNECT(pattern string, h http.HandlerFunc)
CONNECT method route
func (*Mux) Group ¶ added in v0.5.0
Group adds a new inline-Router along the current routing path, with a fresh middleware stack for the inline-Router.
func (*Mux) HttpServeMux ¶ added in v0.5.0
HttpServeMux DO NOT USE it for routing, exposed only for edge cases.
func (*Mux) OPTIONS ¶ added in v0.5.0
func (m *Mux) OPTIONS(pattern string, h http.HandlerFunc)
OPTIONS method route
func (*Mux) PrintRoutes ¶ added in v0.5.0
func (*Mux) Resource ¶ added in v0.5.0
func (m *Mux) Resource(pattern string, fn func(res *Resource), mw ...func(http.Handler) http.Handler)
Resource routes mapping by using HTTP verbs
- GET /pattern view all resources
- GET /pattern/create new resource view
- POST /pattern create a new resource
- GET /pattern/:id view a resource
- PUT /pattern/:id update a resource
- PATCH /pattern/:id partial update a resource
- DELETE /resource/:id delete a resource
func (*Mux) ServeHTTP ¶ added in v0.5.0
func (m *Mux) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (*Mux) TRACE ¶ added in v0.5.0
func (m *Mux) TRACE(pattern string, h http.HandlerFunc)
TRACE method route
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func (*Resource) Create ¶
func (res *Resource) Create(h http.HandlerFunc)
Create a new resource
POST /pattern/create
func (*Resource) CreateView ¶ added in v0.5.0
func (res *Resource) CreateView(h http.HandlerFunc)
CreateView new resource
GET /pattern/create
func (*Resource) Delete ¶ added in v0.5.0
func (res *Resource) Delete(h http.HandlerFunc)
Delete a resource
DELETE /pattern/:id
func (*Resource) HandleDELETE ¶ added in v0.7.1
func (res *Resource) HandleDELETE(pattern string, h http.HandlerFunc)
HandleDELETE on /group-pattern/:id/pattern
func (*Resource) HandleGET ¶ added in v0.7.1
func (res *Resource) HandleGET(pattern string, h http.HandlerFunc)
HandleGET on /group-pattern/:id/pattern
func (*Resource) HandlePATCH ¶ added in v0.7.1
func (res *Resource) HandlePATCH(pattern string, h http.HandlerFunc)
HandlePATCH on /group-pattern/:id/pattern
func (*Resource) HandlePOST ¶ added in v0.7.1
func (res *Resource) HandlePOST(pattern string, h http.HandlerFunc)
HandlePOST on /group-pattern/:id/pattern
func (*Resource) HandlePUT ¶ added in v0.7.1
func (res *Resource) HandlePUT(pattern string, h http.HandlerFunc)
HandlePUT on /group-pattern/:id/pattern
func (*Resource) Index ¶
func (res *Resource) Index(h http.HandlerFunc)
Index of all resource.
GET /pattern
func (*Resource) Update ¶
func (res *Resource) Update(h http.HandlerFunc)
Update a resource
PUT /pattern/:id
func (*Resource) UpdatePartial ¶ added in v0.5.0
func (res *Resource) UpdatePartial(h http.HandlerFunc)
UpdatePartial resource info PATCH /pattern/:id
func (*Resource) View ¶ added in v0.5.0
func (res *Resource) View(h http.HandlerFunc)
View a resource
GET /pattern/:id