4

我有一个小的 compojure 站点,其路由定义如下:

(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"))

当我尝试加载项目时,出现此错误:
java.lang.Exception: Unsupported binding form: (or (serve-file (params :*)) :next)

我究竟做错了什么?我从互联网上分散的示例中获取了大部分内容。

添加空向量后,我收到此错误:
java.lang.Exception: Unable to resolve symbol: serve-file in this context

4

1 回答 1

6

我认为您缺少绑定表单:

(GET "/*" {params :params} (or (serve-file (params :*)) :next))
        ; ^- note the binding form
于 2010-10-08T18:56:04.810 回答