render
v1.0.0
github.com/glkz/chi/_examples/rest/render
Documentation
pkg.go.dev ↗Responder as a wrapper of https://github.com/unrolled/render -- This is a good base to work off and extend for your own uses, or build your own. For example, adding pagination to JSON() where you add a "Link" header that is a cursor URL to the next page of results (check how GitHubb does it in their API docs). The power is yours.
Variables
Renderer
var ( Renderer *renderer.Render )
Functions
Data
func Data(w http.ResponseWriter, status int, v []byte) error
HTML
func HTML(w http.ResponseWriter, status int, name string, binding interface{}, htmlOpt ...renderer.HTMLOptions) error
JSON
func JSON(w http.ResponseWriter, status int, v interface{}) error
JSONP
func JSONP(w http.ResponseWriter, status int, callback string, v interface{}) error
Render
func Render(w http.ResponseWriter, e renderer.Engine, data interface{}) error
Text
func Text(w http.ResponseWriter, status int, v string) error
XML
func XML(w http.ResponseWriter, status int, v interface{}) error