Closed amellnik closed 7 years ago
Using Mux may be blocked by https://github.com/JuliaWeb/Mux.jl/issues/28.
@ChrisRackauckas -- I'm currently stuck on Mux given it's lack of documentation and illegible code. If you can figure out how to include custom headers in a response let me know, otherwise I'm switching over to using HttpServer directly.
Here is how you do it.
# Access-Control-Allow-Origin: *
function withCorsHeader(res)
headers = HttpCommon.headers()
headers["Access-Control-Allow-Origin"] = "*"
Dict(
:headers => headers,
:body=> res
)
end
@app service = (
Mux.defaults,
page("/data", res -> withCorsHeader(Json.json(getData())))
)
Best of luck!
Done.
I think that since we're going to handle all the scaling and provisioning outside the container, we should just write a very simple server in Mux.jl instead. Implementing this would also close #1.