Documentation
¶
Index ¶
- type Resource
- func (r *Resource) Create(h http.HandlerFunc)
- func (r *Resource) Destroy(h http.HandlerFunc)
- func (r *Resource) Index(h http.HandlerFunc)
- func (r *Resource) New(h http.HandlerFunc)
- func (r *Resource) PartialUpdate(h http.HandlerFunc)
- func (r *Resource) Show(h http.HandlerFunc)
- func (r *Resource) Update(h http.HandlerFunc)
- func (r *Resource) Use(middlewares ...func(http.Handler) http.Handler)
- type Router
- func (r *Router) CONNECT(pattern string, h http.HandlerFunc)
- func (r *Router) DELETE(pattern string, h http.HandlerFunc)
- func (r *Router) GET(pattern string, h http.HandlerFunc)
- func (r *Router) Group(fn func(grp *Router))
- func (r *Router) HEAD(pattern string, h http.HandlerFunc)
- func (r *Router) OPTIONS(pattern string, h http.HandlerFunc)
- func (r *Router) PATCH(pattern string, h http.HandlerFunc)
- func (r *Router) POST(pattern string, h http.HandlerFunc)
- func (r *Router) PUT(pattern string, h http.HandlerFunc)
- func (r *Router) Resource(pattern string, fn func(resource *Resource))
- func (r *Router) Serve(cb ServeCB)
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) TRACE(pattern string, h http.HandlerFunc)
- func (r *Router) Use(h ...func(http.Handler) http.Handler)
- func (r *Router) With(middleware ...func(http.Handler) http.Handler) *Router
- type ServeCB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource is a resourceful route provides a mapping between HTTP verbs and URLs and controller actions. By convention, each action also maps to particular CRUD operations in a database. A single entry in the routing file, such as Index route
GET /resource-name # index route
GET /resource-name/new # create resource page
POST /resource-name # create resource post
GET /resource-name/:id # view resource
GET /resource-name/:id/edit # edit resource
PUT /resource-name/:id # update resource
DELETE /resource-name/:id # delete resource
func (*Resource) Create ¶
func (r *Resource) Create(h http.HandlerFunc)
Create is POST /resource-name
func (*Resource) Destroy ¶
func (r *Resource) Destroy(h http.HandlerFunc)
func (*Resource) PartialUpdate ¶
func (r *Resource) PartialUpdate(h http.HandlerFunc)
PartialUpdate is PATCH /resource-name/:id
func (*Resource) Update ¶
func (r *Resource) Update(h http.HandlerFunc)
Update is PUT /resource-name/:id
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a wrapper around the go's standard http.ServeMux. It's a lean wrapper with methods to make routing easier
func (*Router) CONNECT ¶
func (r *Router) CONNECT(pattern string, h http.HandlerFunc)
CONNECT method route
func (*Router) DELETE ¶
func (r *Router) DELETE(pattern string, h http.HandlerFunc)
DELETE method route
func (*Router) Group ¶
Group adds a new inline-Router along the current routing path, with a fresh middleware stack for the inline-Router.
func (*Router) PATCH ¶
func (r *Router) PATCH(pattern string, h http.HandlerFunc)
PATCH method route
func (*Router) Resource ¶
Resource resourceful route provides a mapping between HTTP verbs for given the pattern
func (*Router) TRACE ¶
func (r *Router) TRACE(pattern string, h http.HandlerFunc)
TRACE method route