gpt4 book ai didi

clojure - Compojure 路由问题

转载 作者:行者123 更新时间:2023-12-02 18:37:55 25 4
gpt4 key购买 nike

我有一个小型 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:不支持的绑定(bind)形式:(或(serve-file (params :*)) :next)

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

添加空向量后,出现此错误:
java.lang.Exception:无法解析符号:在此上下文中提供服务文件

最佳答案

我认为您缺少绑定(bind)表格:

(GET "/*" {params :params} (or (serve-file (params :*)) :next))
; ^- note the binding form

关于clojure - Compojure 路由问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3893344/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com