When run >julia server.jl
The Timer
is not triggered. Is this caused by Bukdu? Thanks!
#server.jl
using Bukdu
using HTTP
const g_temp_data = Ref{String}
function do_work(t)
g_temp_data[] ="Hello the word"
println("call do_work()")
end
timer = Timer(do_work, 1; interval=20)
struct RouteController <: ApplicationController
conn::Conn
end
function index(c::RouteController)
output = g_temp_data[]
render(JSON, output)
end
routes() do
get("/", RouteController, index)
end
Bukdu.start(8885, host="0.0.0.0", enable_remote_ip=true)
Base.JLOptions().isinteractive == 0 && wait()