how can i serve different directories under the sa...
# ktor
a
how can i serve different directories under the same remote path in ktor server? I have a folder called
css
and an other called
public
. I want the contents of both to be served at
/
a
Unfortunately, you cannot do that with the
staticFiles
and
staticResources
. You can write a route handler that will serve the files from both directories.
a
how can i do that?
a
You can define a route with a tailcard path and use the `LocalFileContent`class to respond with the requested files. You can check if the file exists in the first directory and if not, proceed to the second one. You can take a look at the implementation of the staticFiles for reference.
👍 1