首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Compojure路由问题

Compojure路由问题
EN

Stack Overflow用户
提问于 2010-10-09 02:36:23
回答 1查看 2.7K关注 0票数 4

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

代码语言:javascript
复制
(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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-10-09 02:56:05

我想你遗漏了一个绑定形式:

代码语言:javascript
复制
(GET "/*" {params :params} (or (serve-file (params :*)) :next))
        ; ^- note the binding form
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3893344

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档