Closed vlio20 closed 5 years ago
Not possible I'm afraid.
Is there any way to workaround it? redirects?
If your main problem with using nested directories is that index.html
has to be in one URL, I would write a custom handler that serves that particular file. Or maybe I misunderstood?
There are 2 things here:
Something like this?
staticFiles.location("/public"); // put `/site/static/` dirs in here
get("/site", (req, res) ->
Spark.class.getResourceAsStream("/public/site/static/index.html")
);
Can you please also show the Kotlin version of your suggestion?
found it:
Spark::class.java.getResourceAsStream()
Trying to make it work
@tipsy it did work. Though I think this feature should be baked into the framework.
Thanks!
Hi, Fom the documentation I see that the static files are read from the resources folder:
And would be served when the following url would be provided:
My question is: is it possible to place the files in the
resources/public
but access it with a different url. For example:http://{host}:{port}/MyApp/site/static
Note: putting nested directories will result putting the index.html file in to url in order to get it server (which should be the default response)