I'm trying to load Ring's wrap-reload
middleware as an interceptor. I think since wrap-reload
returns a handler function that an interceptor created from wrap-reload
would also necessarily be a handler, and would therefore have to go at the end of the interceptor queue. Is that right?
@ctamayo perhaps Pedestal’s service-tools
dev tooling is a better fit for you? https://github.com/pedestal/pedestal/blob/master/service-tools/src/io/pedestal/service_tools/dev.clj
aha, yeah that looks promising! Thanks!
np!
I'm a little confused about how/where to use this, though...do I wrap the expanded routes var in run-dev
? So something like...
;; Routes can be a function that resolve routes,
;; we can use this to set the routes to be reloadable
::server/routes #(route/expand-routes (dev-tools/watch-routes-fn (deref #'service/routes)))
or ::server/routes #(dev-tools/watch-routes-fn (route/expand-routes (deref #'service/routes)))
?? both of these throw runtime exceptions
@ctamayo, watch
should be sufficient. The fact that the run-dev
service map uses (deref #'service/routes)
leads to the routes being evaluated on every request