Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Responder ¶
type Responder struct {
// contains filtered or unexported fields
}
Responder holds the mappings of content-type to handler
func Wants ¶
Wants maps a content-type, or part of one ("json", "html", "form", etc...), to a buffalo.Handler to respond with when it gets that content-type, returns a Responder that can be used for further mappings.
func (Responder) Respond ¶
Respond with a mapped buffalo.Handler, if one exists, returns an error if one does not.
func UserList(c buffalo.Context) error { // do some work return responder.Wants("html", func (c buffalo.Context) error { return c.Render(200, r.HTML("some/template.html") }).Wants("json", func (c buffalo.Context) error { return c.Render(200, r.JSON(user)) }).Respond(c) }
Click to show internal directories.
Click to hide internal directories.