Is it possible to list all available endpoints on ...
# ktor
s
Is it possible to list all available endpoints on the server? For KTor 3...
a
You can use the the RoutingNode.getAllRoutes method to do that. Here is an example:
Copy code
val server = embeddedServer(Netty, port = 8080, host = "0.0.0.0", module = {
    routing {
        get("/1") {}
        get("/2") {}
    }
})

server.monitor.subscribe(ApplicationStarted) {
    val rootNode = server.application.plugin(RoutingRoot)
    println(rootNode.getAllRoutes())
}

server.start(wait = true)
👍 1