Пример #1
0
func HandleRateStruct(req *gsix.GRequest, resp *gsix.GResponse) {
	body := struct {
		Pair string
		Ask  float32
		Bid  float32
	}{"EUR/USD", 43.4, 43.6}

	resp.Format(map[string]func(){
		"application/json": func() {
			resp.SendStruct(200, body)
		},
		"text/html": func() {
			resp.Render("index.html", body, nil)
		},
		"default": func() {
			resp.SendStruct(200, struct{}{})
		},
	})
}
Пример #2
0
func HandleRates(req *gsix.GRequest, resp *gsix.GResponse) {
	resp.Send(200, "These are the rates:  BLAHHHHHHH!!")
}