I'm playing with KotlinNative for a Demo, is someo...
# http4k
u
I'm playing with KotlinNative for a Demo, is someone ever tried a port of Http4k to KN?
I think they added a multiplatform DateTime... I have to check.
InputStreams doesn't seem jvm related but of course it depends on what you are using as webserver. I noticed a KN one called KwangIO
s
IIRC at the time there was no multiplatform InputStream, and I didn't feel like it was something we should implement 😉
u
mmmh no DateTime either but there are 3rd party implementations
s
yeah. That was our trade-off: keep the dependencies low until the Kotlin multiplatform ecosystem matures a bit.
u
yeah makes sense. I suppose a one-off port is possible but not keeping a single codebase,
I will stick with KwangIO for the moment then 🙂
I can probably add a HttpHandler kind of interface to it... 🤭
s
The actual core of http4k is pretty small. If you could fit it to KwangIO's I/O model perhaps it's a good start.
u
After looking at the code of KwangIO I decided it would be better to try to implement a http4k backend directly on top of something like mongoose...
d
@Uberto Barbini if you're keen, I'd love to have the repo for that native port somewhere in the http4k org on GitHub, even as an experiment. 🙃
u
The problem is that there is no easy way to have a Web server in kotlin native. So for my talk i wrote one from scratch :) Of course ultra limited but it works for small things and it's fast and its 300kb in all :)
Maybe next talk i can connect with http4k :))
d
Would love to see it - is it online anywhere?
u
atm it's not even parsing the headers and the request cannot be bigger than 1k, but for super stupid REST it actually works and it has a Http4k-like handler 🙂