can you see this <@U092308M7> ? : <https://github....
# ktor
c
can you see this @orangy ? : https://github.com/codeslubber/kstaticgen
o
codeslubber: yep, let me clone it
c
Look at TestServer, you can double click main and do run, then go to localhost:8080 and see the request hits,
but the file is not found 🙂
o
Gradle is downloading internet
c
great
*/ class TestServer { companion object { @JvmStatic fun main(args: Array<String>) { embeddedServer(Jetty, 8080) { routing { get(“/”) { default(“index.html”) println(“cwd = ” + File(“.”).absolutePath) files(“/site”) } } }.start(wait = true) } } }
I never pushed this version, difference is simply addition of the get(“/”)
o
But where is
site
?
c
I have tried it in a bunch of places
do you see it off the root?
it’s also in /src/main/resources
but the cwd when the server starts seems to be the project root?
o
works for me with the following change
default("site/index.html")
c
awesome! thanks @orangy
so I sohuld just remove the files(site) right?
o
Or you can use this:
Copy code
static {
                        staticRootFolder = File("site")
                        default("index.html")
                        files(".")
                    }
It sets root folder for all static operations
c
I like that even better
might be a good idea to add an example?
(not whining at all…)
o
yep, need content here (https://github.com/Kotlin/ktor/wiki/Feature-Static-Content) but @hhariri is really busy these days
c
so I’ve noticed…
I guess I should have done that myself, tracing through it.. I was also thinking about how negative cases are always a drag, it would be so nice if you had something where it just dumped the state of it’s reasoning about content location when failures occurred, or better yet, just a pill you could invoke, e.g. localhost:8080/configState
?