a light framework to start an asynchronous http server
written in kotlin, based on undertow & rxjava
in development
Swak's philosophy is to keep everything easily doable from code.
Support of configuration file will be supported but will always be a secondary way to configure your server.
swak api aims to be simple, flexible and safe typed
well... we all know kotlin coders got the swak
to start a http server on port 80, you simply write
SwakServer().start()
Doing this will throw a NoRouteProvided
exception: swak refuse to start a server doing nothing.
to start a http server answering "hello world" on "/hi"
SwakServer {
handle("/hi", GET) { Single.just(Response(body = "hello world")) }
}.start()
swak also support path param:
SwakServer {
handle("/hi/{me}", GET) { request ->
Single.just(Response(body = "hello ${request.pathParams["me"]}"))
}
}.start()