Noon van der Silk - HTMX and Servant: Seamless and powerful handling of HTTP errors in HTMX

submited by
Style Pass
2024-05-07 09:30:04

As part of the interview process for a company I was recently rejected by, I wrote a blog post about HTMX and Haskell (and, JavaScript, but that was just a requirement :D).

I think the post is interesting in any case, so here it is :) The Haskell component is in the Bonus content. If you want to skip straight to the code, you can just go direct to the repo: htmx-servant-js-example.

HTMX is a popular front-end JavaScript library that can be used to create simple dynamic UIs. But how robust is it? Is it ready for production use? And what are its features, anyway? Let’s explore it together by building an image conversion app.

You are building a dynamic UI and calling endpoints that will either fail or return some content to render. You want to handle both these cases with the simplest code possible.

It’s a bit of a hassle to write this logic all over the place. Can HTMX help us out here? How does it look for something non-trivial, and what are the caveats we should be aware of?

Leave a Comment