Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/installation/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Clojure Compojure中的组合路由_Clojure_Compojure - Fatal编程技术网

Clojure Compojure中的组合路由

Clojure Compojure中的组合路由,clojure,compojure,Clojure,Compojure,我在Clojure中使用Compojure开发了两个不同的web应用程序。每个都使用defroutes创建其处理程序 如何将defroute的两个不同定义合并为一个defroute?我想将第一个应用程序的路由重新使用到第二个应用程序中。您可以使用来组合路由: (def my-handler (routes some-handler some-other-handler)) 我尝试了(def route1[(GET”/“[](index page))(route

我在Clojure中使用Compojure开发了两个不同的web应用程序。每个都使用defroutes创建其处理程序

如何将defroute的两个不同定义合并为一个defroute?我想将第一个应用程序的路由重新使用到第二个应用程序中。

您可以使用来组合路由:

 (def my-handler
    (routes some-handler
            some-other-handler))

我尝试了(def route1[(GET”/“[](index page))(route/resources/)(route/not found“page not found”))(def allroutes(concat routes1 routes2))(def app(handler/site(apply routes allroutes)))但是第二个路由不可用。我发现了错误:需要注意在第一个列表中没有路由未找到处理程序…”好的,我发现了错误:需要注意在第一个列表中没有路由未找到处理程序…-“请详细说明?你发现了什么解决方案?可能有点晚了,但我认为关键是
未找到
路由应该是路由列表中的最后一个,否则它将匹配所有url,应用程序将始终返回“未找到”