Open zendevil opened 4 years ago
I agree. But Reitit is compatible. I am using it myself. For example:
(r/ring-handler
(r/router
[["/" {:get index}]
["/faq" {:get index}]
["/support" {:get index}]])
(r/routes
(r/create-resource-handler {:path "/" :root ""})))
This plays well within a defsystem declaration.
@danielsz. I'm using bidi currently but how do I change my app-system to use reitit? I've tried a bunch of things.
(defn app-system [config]
(component/system-map
:routes (new-endpoint home-routes)
:middleware (new-middleware {:middleware (:middleware config)})
:handler (-> (new-handler :router :bidi) ;; <---- :reitit option here.
(component/using [:routes :middleware]))
:http (-> (new-web-server (:http-port config) :handler)
(component/using [:handler]))
:server-info (server-info (:http-port config))))
If there were a (new-handler :router :reitit)
option that would be great. I tried adding in the new-handler
function of system.components.handler
:reitit #(ns-resolve 'reitit.ring (symbol "ring-handler"))
but it didn't work.
(defn app-system [config]
(component/system-map
:routes (new-endpoint home-routes)
:middleware (new-middleware {:middleware (:middleware config)})
:handler (-> (new-handler) ;; <---- nothing needed here.
(component/using [:routes :middleware]))
:http (-> (new-web-server (:http-port config) [:handler])
(component/using [:handler]))
:server-info (server-info (:http-port config))))
With home-routes
being defined like I mentioned in the first post.
(defn home-routes [_]
(r/ring-handler
(r/router
[["/" {:get index}]
["/faq" {:get index}]
["/support" {:get index}]])
(r/routes
(r/create-resource-handler {:path "/" :root ""}))))
Removing :router :bidi
from (new-handler)
gives me the following error:
Execution error at system.components.handler/new-handler$fn (handler.clj:79).
No namespace: compojure.core found
You would have to include compojure
as a dependency in your project to get rid of the message.
Yes, I have tried that but still get the error.
Hi @danielsz, I still get the compojure error after adding the compojure dependency. Why might this be?
Reitit is an extremely fast and nifty routing library that deserves to be compatible with system.handler.