11

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?

LotAbout
  • 707
  • 5
  • 18

1 Answers1

13

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

Community
  • 1
  • 1
Daniel Compton
  • 13,878
  • 4
  • 40
  • 60
  • 1
    Chestnut works! After check for the source code, I found that chestnut will start a jetty server when calling `(run)`. Simply add the `wrap-reload` middleware will not work(I've tried it before asking). So the reason may be that `lein figwheel` will not start jetty server at all. I'll try to find out later. – LotAbout May 16 '15 at 03:28
  • Is there a way to do this only with `lein figwheel` (without chestnut)? – leontalbot Jul 28 '15 at 17:49
  • Sure, copy what they do for the server in Chestnut or use wrap-reload directly. – Daniel Compton Jul 28 '15 at 20:56