Hanami, Why?: Class Action

1 Like

The other complaint I have heard about Hanami actions (though far less often) is around a general distaste for the more “functional” approach of handle and having to pass the request and response around between methods.

This is such an utterly normal way to express an HTTP handler I have a hard time imagining why someone would complain about this. Someone who’s been stuck in Rails for too long, and hasn’t poked their head out of it and looked what other people were doing.

Take, for instance, the function interface for a Go handler:

func handler(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "text/plain")
    w.WriteHeader(http.StatusOK)
    fmt.Fprintln(w, "Hello, World!")
}
1 Like

Anyone else remember Focused Controller?

edit: fixed link

1 Like