https://kotlinlang.org logo
#http4k
Title
# http4k
u

Uberto Barbini

10/29/2019, 8:59 AM
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

s4nchez

10/29/2019, 9:09 AM
IIRC at the time there was no multiplatform InputStream, and I didn't feel like it was something we should implement 😉
u

Uberto Barbini

10/29/2019, 9:10 AM
mmmh no DateTime either but there are 3rd party implementations
s

s4nchez

10/29/2019, 9:11 AM
yeah. That was our trade-off: keep the dependencies low until the Kotlin multiplatform ecosystem matures a bit.
u

Uberto Barbini

10/29/2019, 9:12 AM
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

s4nchez

10/29/2019, 9:13 AM
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

Uberto Barbini

10/29/2019, 6:59 PM
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

dave

11/03/2019, 10:46 AM
@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

Uberto Barbini

11/03/2019, 2:20 PM
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

dave

11/03/2019, 2:25 PM
Would love to see it - is it online anywhere?
u

Uberto Barbini

11/04/2019, 8:23 AM
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 🙂
2 Views