Fork me on GitHub

Hi, I have figwheel set up with a :ring-handler my-ns/dev-handler. I am using a library ( that needs a setup function (`(frinj-init!)`) to be run before using any of its functions. I don't want to run the function at the top level of a namespace, so I instead run it in -main (which also starts a jetty server that is used in the production build). The problem now is that the function has not run when I am developing, since figwheel doesn't run -main when I have a ring-handler specified (as far as I know), (frinj-init!) has not been run when I start figwheel and try to develop my application. How do I solve this?


@curlyfry: could you do a defonce maybe?


and run the frinj function that way?


@thomas: Thanks for the suggestion, but tried it earlier and it seems to result in an infinite loop when building a jar for production (`compiling my-ns.some-ns` forever)


I was playing with boot the other day and that allows you to run an init function in addition to the handler. not sure if FW supports the same though. and it didn’t quite work for me. so YMMV


Ok, I'll keep looking!


Right now I'm thinking about using the following approach: No :ring-handler for figwheel, and I instead start figwheel in one terminal and my server repl in the other. I then run the function that I want to start the server (`-main` or dev-main depending on which ring handler I want). The problem here is that the server is run on a different host which makes it impossible to use the same endpoints as in production (where everything is on the same host). Is there any solution to this?


Hmm, I guess figwheel reloads the code even if I use the port of the jetty server to access my site. I think this works for now, and then maybe I can move to more advanced configs like when I want to learn more/my app gets bigger