Hey all, I have a html page that the folder struct...
# ktor
s
Hey all, I have a html page that the folder structure/path differs from the remote path that I serve the page from and it references local javascript files and images in its folder, how do I setup the routing to handle that? As a simple example I have a folder
game
that contains
index.html
and
protocol.js
and I serve
game/index.html
file from the route
/myGame
, but then the client will request
protocol.js
from the root. Is there a good way to serve a set of static files that are all in the same subfolder in my project?
a
You can add another route specifically for the
/protocol.js
requests:
Copy code
routing {
    get("/protocol.js") {
        call.respondFile(File("game/protocol.js"))
    }
    staticFiles("/myGame", File("game"))
}