reitit

dgr 2024-05-25T00:52:05.770579Z

Is there a good way to construct a Ring router such that when editing the handler functions associated with routes, one only needs to send the updated handler function to the REPL (e.g., using C-M-x in Emacs), as opposed to evaluating both the handler and the router? The router doesn’t seem to want me to identify a handler with #'handler syntax, which is what I would typically look for in this situation. I assume it’s compiling fixed references to the handler functions and when they are updated, the router is still pointing to the old ones. The handler and the router are located in different source files and so require switching windows, evaluating code in both, etc.

ikitommi 2024-05-25T13:03:52.568469Z

If you update to 0.7.0, you can use Vars as handlers.

ikitommi 2024-05-25T13:06:35.901929Z

also, there is reloading-ring-handler that re-creates the route -tree on every request, good for development: https://github.com/metosin/reitit/blob/master/modules/reitit-ring/src/reitit/ring.cljc#L371

dgr 2024-05-25T15:20:44.763559Z

Ah, perfect, thanks. I was using 0.7.0-alpha7. In looking at the CHANGELOG, I see that got added in alpha8. Just missed it.