I really don't understand this code
I think I understand how receiver work but when /foo gets requested, why that struct becomes receiver to SERVEHTTP which is never called? If this is how http works, is this typical style use of receiver?
main go
import "net/http"
type fooHandler struct {
Message sstring
}
func (f *fooHandler) ServerHTTP(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(f.Message))
}
func main() {
http.Handle("/foo", &fooHandler{Message: "Hello world"})
}