Hacker News new | ask | show | jobs
by AugustoCAS 1341 days ago
I couple of years ago I was lucky to use http4k, a server as a function web library for Kotlin. It was such a wonderful change compared to every other technologies available in both Java and Kotlin. It's simple.

Testing becomes so much easier too, as one can instantiate a the whole web routing aspect, without having to bind it to a port and having to send real http requests.

If strongly suggest people to take a look at it. It's not perfect, but it's a lot simpler than other frameworks and libraries. And it's a shift in some of the current mentality of using heavy frameworks (such as spring boot) which blow up anyone's cognitive load.

https://github.com/http4k/http4k

4 comments

Scala's http4s is also such a lovely framework. Given the name similarity I don't know which came first
The problem is that most Java developers like the cognitive complexity that Java EE frameworks entail. Those who like simplicity generally leave Java behind.
Sounds kind of like Go's HTTP handlers just being functions. Makes testing them very easy since you just call them with an http.ResponseWriter and a http.Request struct.
Not sure what's new here. Handlers were always functions in java (and other languages), even 20 years ago.

PP talks about general setup of the server in http4k (which I'm not a fan actually, because server setup is a very small thing done once. Just as a build file, I actually want it as long and verbose as possible).

Thanks for pointing this out, I had not heard of this one and yes sounds like it shares very similar ideals but for the BE.