A collections of helpers for gorilla/mux and Go's net/http.
func jsonRenderHandler(w http.ResponseWriter, r *http.Request) {
d := map[string]interface{} {
"team": "tfcloud-go",
}
if err := render.JSON(w, http.StatusOK, d); err != nil {
// do something
}
}
func textRenderHandler(w http.ResponseWriter, r *http.Request) {
d := "tfcloud-go"
if err := render.Text(w, http.StatusOK, d); err != nil {
// do something
}
}
Licensed under the Apache 2.0. The TFCloud Go Team.