SciML / DiffEqOnlineServer

Backend for DiffEqOnline, a webapp for scientific machine learning (SciML)
http://app.sciml.org/
Other
25 stars 11 forks source link

Move away from JuliaWebAPI.jl #2

Closed amellnik closed 7 years ago

amellnik commented 7 years ago

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.

amellnik commented 7 years ago

Using Mux may be blocked by https://github.com/JuliaWeb/Mux.jl/issues/28.

amellnik commented 7 years ago

@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.

blairn commented 7 years ago

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!

amellnik commented 7 years ago

Done.