4
votes

I have a small compojure site, with the 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 the 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 scattered examples on the internet.

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

1

1 Answers

6
votes

I think you're missing a binding form:

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