简体   繁体   中英

Serving static file from Compojure

I'm trying to have a self-executable app that will runs jetty and a Compojure webapp. The user who will deploy the app should be able to modify manually the css files and some configurations files, so packaging as a WAR is not a solution for me.

My idea is to have a self-executable JAR in one directory and a webdata/static/css directory under it.

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

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

What is the problem?

Ok I found the error, the path wasn't specified correctly. This code works:

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

The tree structure of the project is then like this:

standalone-jar.jar
webdata
    |_public
      |_css

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM