Пример #1
0
func fibRequest(req *G.Request, resp *G.Message) {
	pack := map[string]float64{}
	req.Data(&pack)

	next := pack["first"] + pack["second"]
	fmt.Printf("First %.0f Second %.0f Next %.0f \n",
		pack["first"], pack["second"], next)
	resp.SetData(next)
}
Пример #2
0
func echoReply(req *G.Request, resp *G.Message) {
	var msg string
	req.Data(&msg)
	fmt.Println("Echoserver: received", msg)
	resp.SetData(fmt.Sprintf("Pong %v", msg))
}
Пример #3
0
func getInput(req *G.Request) (out string) {
	if err := req.Data(&out); err != nil {
		panic(err)
	}
	return
}