I'm developing with Cowboy and erlang.mk and currently my flow is : 1. change code in vi, save, run make 2. close Cowboy, start Cowboy again (i'm running Cowboy in console mode for tracing/debugging purposes)
Is there a way to make Cowboy reload and restart itself automatically with as little lag as possible? I understand I could add Cowboy stop and start to my makefile but maybe there is a better/more responsive way?
I saw there is sync package from rustyio but it seems overly complicated to have to hook it into my app directly.
The hotCodeReloading option enables special compilation mode where changes in the code can be applied automatically to a running program. The code reloading happens at the granularity of an individual module.
Hot reloading allows you to see the changes that you have made in the code without reloading your entire app. Whenever you make any changes, all you need to do is save your code. As soon as you save your code, React Native tracks which files have changed since your last saved, and only reload those file for you.
I use rebar all the time. In rebar.config, I have
{deps,[
{sync, ".*", {git, "git://github.com/rustyio/sync", {tag,"master"}}},
}
I use a .erlang file, typically placed in src/.erlang with the following two lines
code:add_path("../deps/sync/ebin").
sync:go().
Now, whenever I save a file, it is reloaded. I see no reason why this shouldn't work for Cowboy
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