static("/") {
val root = File("rest-api/webapp")
if(!root.exists()) {
throw RuntimeException("Unable to locate static content")
}
staticRootFolder = root
default("index.html")
}
what I have right now
Luis Munoz
06/30/2020, 3:49 AM
best I came up with
Luis Munoz
06/30/2020, 3:49 AM
Copy code
fun Route.defaultWithNoCache(localPath: File) {
get {
if (localPath.isFile) {
call.response.cacheControl(CacheControl.NoCache(CacheControl.Visibility.Private))
call.respond(LocalFileContent(localPath))
}
}
}