GO Web Services
Handling Requests
- Handle a handler to handle requests matching a pattern
- HandleFunc a function to handle requests matching a pattern
type fooHandler struct {
Message string
}
func (f *fooHandler) ServeHTTP(w http.ResponseWrite, r *http.Request) {
w.Write([]byte(f.Message))
}
func main() {
http.Handle("/foo", &fooHandler{Message: "hello Word"})
}