Fork me on GitHub
#ring
<
2023-09-05
>
James Amberger22:09:47

I’m not sure I am taking full advantage of the repl when developing my ring app. If I modify a function in my editor and eval the definition, I then have to (future-cancel) the server and start a new one. What should I be doing?

seancorfield22:09:12

Specifically, using #'handler instead of handler when starting your server and wrapping your handler with middleware. (hard to be more specific without seeing your code)

James Amberger23:09:44

Yes, using #' seems to be what I’m missing. Thanks @U04V70XH6

Ben Sless05:09:25

If you care about performance very much, another option is to eta expand the function:

(fn ([request] (handler request))
    ([request s f] (handler request s f)))

Ben Sless05:09:47

You can call it a compiler trick

Ben Sless05:09:39

But what I like doing in the repl is to not bring up a server, but have a function that returns my handler then call it and apply the handler to a request built with ring.mock

❤️ 1