elixirelixir-mixplug

What is the best way to enable development hot reloading when not using pheonix?


So I'm learning Elixir and Pheonix looked too much to start learning, so I make a simple JSON Rest API with Plug and Poison, but to see any changes I need to stop the server and run mix run --no-halt again. I came from nodeJS and it has nodemon that just tracks all files that depend from root module and reloads the whole server if it sees any changes. Is there something similar for mix or elixir. I know you can reload specific parts of the code with OTP, it would be the best if my server did that on save, but right now I just want a faster response of what I've done. Can anyone point me in the right direction for this?


Solution

  • I never was a big fan of hot reloading; what works for me, you start the project as iex -S mix ... and issue recompile from iex console whenever you need the code to be reloaded.

    That makes you full control on what version is currently running and preserves the system from unwanted attempts to recompile a WIP-code.

    If you still want it to be automated, check Lettuce package.