Coverage Summary for Class: WebappKt (dev.suresh.routes)
Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
WebappKt |
0%
(0/4)
|
|
0%
(0/5)
|
0%
(0/36)
|
WebappKt$webApp$1$2 |
0%
(0/1)
|
0%
(0/2)
|
0%
(0/2)
|
0%
(0/27)
|
Total |
0%
(0/5)
|
0%
(0/2)
|
0%
(0/7)
|
0%
(0/63)
|
package dev.suresh.routes
import io.ktor.server.http.content.*
import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
fun Routing.webApp() {
webApp("/app", "app")
}
fun Routing.webApp(remotePath: String, basePackage: String) {
staticResources(remotePath, basePackage) {
exclude { it.path.endsWith(".log") }
default("index.html")
modify { url, call ->
when (call.request.path()) {
remotePath -> call.respondRedirect("$remotePath/")
}
}
}
}