Problems with Compojure Routes

I have a small compojure site, with routes defined as such:

(defroutes example (GET "/" [] {:status 200 :headers {"Content-Type" "text/html"} :body (home)}) (GET "/*" (or (serve-file (params :*)) :next)) (GET "/execute/" [] {:status 200 :headers {"Content-Type" "text/html"} :body (execute-changes)}) (GET "/status/" [] {:status 200 :headers {"Content-Type" "text/html"} :body (status)}) (route/not-found "Page not found")) 

When I try to load a project, I get this error:
java.lang.Exception: Unsupported binding form: (or (serve-file (params :*)) :next)

What am I doing wrong? I took most of this from disparate examples on the Internet.

After adding an empty vector, I get this error:
java.lang.Exception: Unable to resolve symbol: serve-file in this context

+4
source share
1 answer

I think you are missing the binding:

 (GET "/*" {params :params} (or (serve-file (params :*)) :next)) ; ^- note the binding form 
+6
source

All Articles