I'm new to clojure and compojure and I was wondering if there's a way to do a hot reload of code changes as you can with Ruby's Sinatra (with the shotgun gem) or Java's Play!
I'm following along with this Heroku tutorial so if there's a way to do it with the foreman gem that would work too.
thanks!
Take a look at this SOq:
and this tutorial:
The suggestion is to use ring's reload middleware.
Recent versions of Compojure make it even easier by incorporating all of the middleware into a single function call:
https://github.com/weavejester/compojure/wiki/Getting-Started
In particular...
(require '[compojure.handler as handler])
; define my-routes in here as normal
(handler/site my-routes)
I'm using some of this in my own projects. It works well, but I'll switch back to choosing ring middleware directly if I decide that I need to add or remove anything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With