Anyone know how to get static files working with k...
# ktor
h
Anyone know how to get static files working with ktor? The sample seems a bit outdated (albeit still doesn’t work for me).
Copy code
static("public") {
    staticRootFolder = File(Server::class.java.classLoader.getResource("static").file)
    resources("styles")
    resources("js")
}
while my css file is in resources/static/styles/master.css, when i go to
localhost:7000/public/styles/master.css
i receive a 404
s
Just a guess but shouldnt you use
staticBasePackage
instead ?
1
Seems you mix file and resource parts.. but just guessing
g
why do you need staticRootFolder?
btw official docs cover this and doesn’t look as outdated https://ktor.io/servers/features/static-content.html#serving-embedded-resources
👍 1
h
i see. thanksl