Ejemplo n.º 1
0
func JSONHandler(m interface{}, w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json")
	b := introspection.ConvertToJson(m)
	w.Write(b)
	//fmt.Fprintf(w, renderJson(w, res))
}
Ejemplo n.º 2
0
func PostJSONHandler(w http.ResponseWriter, r *http.Request) {
	var p model.Post = model.Post{0, "Test", "test post please ignore", 1, true, time.Now(), time.Now()}
	w.Header().Set("Content-Type", "application/json")
	b := introspection.ConvertToJson(p)
	w.Write(b)
}