Live reload API

I wonder is there any mechanism to implement live reload in case one develops REST API?

As an example, consider the following code, which is defined in file “server.jl”

using HTTP

function hello(r)
    return HTTP.Response(200, "Hello")
end

const ROUTER = HTTP.Router()

HTTP.@register(ROUTER, "GET", "", hello)

HTTP.serve(ROUTER)

Now, if I start this server with julia server.jl, then in shell I can get

sh> curl localhost:8081
Hello%

So, if I want to make changes to the function hello, is it possible to get new version of this function without restarting the server?

I’ve seen [ANN] LiveServer: A simple development server with live-reload capability, but as far as I understood it is more suitable for static HTML, or I wasn’t able to figure out, how to bend it for my usecase.

I do not mind any sort of hacks (and Revise is totally fine of course) as long as they work.

There is some discussion and examples in this issue: HTTP.jl#587.

Awesome, this comment update docs with an example showing use with Revise.jl · Issue #587 · JuliaWeb/HTTP.jl · GitHub worked without any issues.

It would be nice to document it somehow, though even in my case it required small changes to work properly, so it’s hard to say what is the proper documentation.