ring

mister_m 2021-10-04T20:39:49.013900Z

For anyone interested, I found some supplementary material on Component used in Sean's example: https://www.youtube.com/watch?v=13cmHf_kt-Q (The author discussing the design and rationale behind Component)

mister_m 2021-10-04T00:10:03.006800Z

just getting started with ring; this lein plugin enabling hot reloading of handlers I'm messing around with is pretty neat.

seancorfield 2021-10-04T00:10:58.007400Z

@radicalmatt If you take a bit of care to write REPL-friendly code, you don't need any of that code reloading stuff.

seancorfield 2021-10-04T00:13:00.009500Z

At work, we develop against a running REPL and don't use any plugins or middleware for reloading. We evaluate every change as we make it, we write "REPL-friendly" code using #'some-var references (instead of plain some-var) where we need the extra indirection, usually around Ring middleware stacks, and then we don't need to reload or restart anything: the web app is always running the latest code.

❤️ 1
mister_m 2021-10-04T00:15:30.010200Z

This is what I am referring to https://github.com/ring-clojure/ring/wiki/Setup-for-development#setup-using-the-lein-ring-plugin - is this not necessary if I were to pass a handler reference to jetty/run-jetty ?

seancorfield 2021-10-04T00:21:10.011200Z

Correct. And just start the server yourself from your REPL.

seancorfield 2021-10-04T00:21:23.011600Z

That ring plugin is just a bad idea in my opinion.

seancorfield 2021-10-04T00:21:56.012300Z

Take a look at this little example https://github.com/seancorfield/usermanager-example

seancorfield 2021-10-04T00:22:08.012800Z

It's REPL-friendly and avoids any plugins.

mister_m 2021-10-04T00:22:37.013Z

I'll have a look Sean, thanks