suave icon indicating copy to clipboard operation
suave copied to clipboard

Suave live reload

Open haf opened this issue 10 years ago • 5 comments

Spike – something to get you started if you want to pick this issue to work at.

Whenever the user changes a .fs file, the server should recompile and reload. It needs to be in a separate process to make it work consistently with different DLL versions.

haf avatar Nov 09 '15 20:11 haf

I have a prototype of this working. I created an application called Suave.ActiveServer that can be run from the command line to continuously build and serve an application under development. My implementation can be found here: [https://github.com/JohnDoeKyrgyz/suave/commit/10a728251349ca2684fdc1c7a140d235fed8a945]

This is just a prototype so far. I would be interested in some code review / feedback / suggestions to improve this before it becomes a pull request.

JohnDoeKyrgyz avatar Mar 22 '16 18:03 JohnDoeKyrgyz

@JohnDoeKyrgyz Nice :) Give me a couple of evenings and I'll do a review of it!

haf avatar Mar 22 '16 20:03 haf

We already have suave live reloading working with a FAKE build around it. See fsreveal

forki avatar Mar 24 '16 09:03 forki

I have seen it, a lot of this is fetched from there. But it depends on FAKE and it only works with fsx files not DLLs.

haf avatar Mar 24 '16 10:03 haf

Just for reference, since usually live-reloading is only done in development, I handle it like this: https://github.com/Banashek/Universal-FSharp-Samples/blob/master/UniversalLiveReloading/src/App.fs . And use a port-incrementing approach to avoid socketexceptions only when the DEVELOPMENT=true environment variable is set.

This is with dotnet core, so I can run dotnet watch run and it will auto restart the suave application, though on another port since the old port is not freed early enough to rebind to.

Banashek avatar Jan 26 '17 01:01 Banashek