【问题标题】:Compojure multiple contexts组合多个上下文
【发布时间】:2015-02-22 23:58:52
【问题描述】:

我有一个defroutes 喜欢:

(defroutes app-routes
  (context "first" []
    (GET "/" [] "first first"))
  (context "second" []
    (GET "/" [] "first second")))

但当我尝试访问 /second 时,我只收到 404。我该怎么办?

【问题讨论】:

    标签: clojure compojure


    【解决方案1】:

    次要但重要的细节:您在上下文声明中缺少前导斜杠,例如“/first”,而不是“first”。

    (defroutes 应用程序路由 (上下文“/第一”[] (GET "/" [] "先到先")) (上下文“第二”[] (GET "/" [] "第一秒")))

    【讨论】:

      猜你喜欢
      • 2015-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-04
      • 1970-01-01
      • 2020-05-08
      • 2018-02-05
      • 1970-01-01
      相关资源
      最近更新 更多