z1naOK9nu8iY5A
z1naOK9nu8iY5A

Reputation: 893

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?

Upvotes: 4

Views: 1702

Answers (1)

z1naOK9nu8iY5A
z1naOK9nu8iY5A

Reputation: 893

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

Upvotes: 2

Related Questions