Exemple #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
}
Exemple #2
0
func (h *ping) Run(res *hal.Response) error {
	return res.Send("PONG")
}