Ktor static resource issue
Kotlin-GDE opened this issue · comments
Halim Dev commented
hi
i create index.html inside static folder in ktor project (resources/static) and i config static resource like this:
static("static") {
default("static/index.html")
}
when invoke http://localhost:8080/static, i expected to show index.html but response 404 appear (resource not found)
Razvan commented
Is not a bug. You are using resources not file so you should use
static("static") {
resources("static")
defaultResource("static/index.html")
}
cf doc: https://ktor.io/servers/features/static-content.html#serving-embedded-resources
Too bad I was hopping to make it my first PR ;)
Halim Dev commented
but in ktor documentation, it's motioned like that
We can also have default files that can be served using default. For instance, on calling
/static with no filename, index.html will be served