Пример #1
0
func handler(w http.ResponseWriter, r *http.Request) {
	data := map[string]interface{}{
		"id":   1,
		"name": "foo",
	}

	jsend.Wrap(w).
		Data(data).
		Status(201).
		Send()
}
Пример #2
0
func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	jw := jsend.Wrap(w)
	h.f(jw, r, h.ctx)
	jw.Send()
}