Skip to content
weavejester edited this page Oct 18, 2011 · 8 revisions

Web applications often need to serve static content, such as images or stylesheets. Ring provides two middleware functions to do this.

One is wrap-file. This serves static content from a directory on the local filesystem:

(use 'ring.middleware.file)
(def app
  (wrap-file your-handler "/var/www/public"))

The other is wrap-resource. This serves static content from the JVM classpath:

(use 'ring.middleware.resource)
(def app
  (wrap-resource your-handler "public"))
Clone this wiki locally