Search code examples
clojureclojurescriptring

How to integrate figwheel with ring server to get back-end auto-reload?


I am new to clojure/clojurescript web development.

  1. Use lein ring server and the modifications(for example routes) will be automatically reloaded to the server(hot-deploy).
  2. Use lein figwheel, and it will spy on the changes of cljs source files and updated to the page accordingly.

Now I started figwheel and modified the back-end code(for example the routes). After I reload the page, the modified contents was not updated.

So Is there a way to integrate figwheel with the ring server so that the back-end change can be updated automatically?


Solution

  • The ring middleware wrap-reload will do this for you. There is also a very nice leiningen template called Chestnut which will set up a project for you with Figwheel and an auto reloading Ring backend.

    This question shows an example of wrap-reload usage Compojure development without web server restarts