Kweb is a novel web framework that acts as a remote interface to the web browser's DOM (Document Object Model). With Kweb, you can create and manipulate DOM elements and listen for and handle events, all using an intuitive Kotlin DSL that mirrors the structure of the HTML being created:
import kweb.*
import kweb.InputType.text
fun main() {
Kweb(port = 8080) {
doc.body {
val name = kvar("")
div {
h1().text("Enter Your Name")
input(type = text).value = name
}
div {
span().text(name.map { "Hello, $it" })
}
}
}
}
Kweb is built on the Ktor framework, which handles HTTP, HTTPS, and WebSocket transport, and is optimized to minimize latency and resource usage on both the server and browser.
2 comments
[ 2.9 ms ] story [ 13.0 ms ] thread