Beispiel #1
0
func (d doubleHandler) ServeCall(req synapse.Request, res synapse.ResponseWriter) {
	var n Num
	err := req.Decode(&n)
	if err != nil {
		res.Error(synapse.StatusBadRequest, err.Error())
		return
	}
	n.Value *= 2
	res.Send(&n)
}
Beispiel #2
0
func (h helloHandler) ServeCall(req synapse.Request, res synapse.ResponseWriter) {
	log.Println("received request from client with addr", req.RemoteAddr())
	res.Send(synapse.String("Hello, World!"))
}