我有一个小的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: 不支持的绑定形式:(or (serve-file (params :*)) :next)
我做错了什么?我大多数是从互联网上零散的示例中获取的。在添加空向量后,我得到以下错误:
java.lang.Exception: 无法解析符号:serve-file
{params:params}
而不是一个空向量,因为Compojure不再为您设置魔术params
本地变量。 - Brian Carper