Hey guys, I want to play a little bit around with ...
# spring
p
Hey guys, I want to play a little bit around with the kotlinx html library, but it seems that I can't make any progress in the most fundamental detail: Returning the html. Since it's a side project, I wanted to try kofu. Here's some code: routes:2
Copy code
fun routes(indexController: IndexController) = router {
    GET("/index", indexController::getIndex)
    GET("/uptime", indexController::getUptime)
}
controller:
Copy code
@Suppress("UNUSED_PARAMETER")
class IndexController(private val indexTemplate: IndexTemplate) {
    fun getIndex(req: ServerRequest) = ok().render("index", indexTemplate.index)
and the HTML:
Copy code
import kotlinx.html.div
import kotlinx.html.dom.create
import kotlinx.html.p
import org.w3c.dom.Document

class IndexTemplate(document: Document) {
    val index = document.create.div {
        p { +"Hello" }
        p { +"you" }
    }
}
However, I can't find the way to respond with html. Unfortunately, sources about the usage of kotlinxhtml and spring are really rare (understandable ofc)