Clojure Compojure中的组合路由
我在Clojure中使用Compojure开发了两个不同的web应用程序。每个都使用defroutes创建其处理程序 如何将defroute的两个不同定义合并为一个defroute?我想将第一个应用程序的路由重新使用到第二个应用程序中。您可以使用来组合路由: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
(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,应用程序将始终返回“未找到”