我有一个小型的组件网站,其路由定义如下:
(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
答案 0 :(得分:6)
我认为你错过了约束形式:
(GET "/*" {params :params} (or (serve-file (params :*)) :next))
; ^- note the binding form