Created a tiny library to experiment another way to compose "Plug"s. Its composition is based on higher order function instead of meta-programming.
It is available at https://github.com/gyson/kob. README page has detailed notes to explain how it works.
Not sure how useful it is because the key benefits are already covered by Plug.Conn.halt
, Plug.Conn.before_send
and Plug.ErrorHandler
as mentioned in README.md. But I really like how simple / easy it’s implemented in Elixir (the core part Kob.compose
is just a few lines of code).
Anyway, just sharing a different idea to compose "Plug"s.