Clojure 复合路由问题
我有一个小型compojure站点,其路线定义如下:Clojure 复合路由问题,clojure,routes,compojure,Clojure,Routes,Compojure,我有一个小型compojure站点,其路线定义如下: (defroutes example (GET "/" [] {:status 200 :headers {"Content-Type" "text/html"} :body (home)}) (GET "/*" (or (serve-file (params :*)) :next)) (GET "/execute/" [] {:status 200
(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:不支持的绑定形式:(或(服务文件(参数:):下一步)
我做错了什么?我从互联网上零散的例子中获取了大部分信息
添加空向量后,我得到以下错误:java.lang.Exception:无法解析此上下文中的symbol:serve文件
我认为您缺少绑定表单:
(GET "/*" {params :params} (or (serve-file (params :*)) :next))
; ^- note the binding form
在最近的Compojure中,我认为它应该是
{params:params}
,而不是空向量,因为Compojure不再为您设置magicparams
本地。