Beispiel #1
0
func ExampleHandler_hear() {
	res := hal.Response{
		Match: []string{},
	}
	h := &hal.Handler{
		Method:  hal.HEAR,
		Pattern: `echo (.+)`,
		Usage:   "echo <string> - repeats <string> back",
		Run: func(res *hal.Response) error {
			res.Send(res.Match[1])
		},
	}
	// output:
	// > echo foo bar baz
	// foo bar baz
}
Beispiel #2
0
Datei: ping.go Projekt: thuvh/hal
func (h *ping) Run(res *hal.Response) error {
	return res.Send("PONG")
}