Serving a static file from Compojure

I am trying to create a bootable application that will launch the jetty and Compojure webapp. The user who will deploy the application should be able to manually modify the css files and some configuration files, so packaging as a WAR is not a solution for me.

My idea is to have a standalone executable JAR in the same directory and below it the webdata / static / css directory.

However, using the following route, the file in the css directory is not served:

(route/files "/static" {:root (str (System/getProperty "user.dir") "/webdata")}) 

What is the problem?

+4
source share
1 answer

Good. I found an error, the path was incorrect. This code works:

 (route/files "/" {:root (str (System/getProperty "user.dir") "/webdata/public")}) 

The tree structure of the project is as follows:

 standalone-jar.jar webdata |_public |_css 
+2
source

Source: https://habr.com/ru/post/1391288/


All Articles