I’ll keep tweaking this, but we should take this to the issues on the repositories now. I think that the JuliaWebAPI is great and very easy to use. I’ll chat around and see if we can get any help hosting this, but please take your time: we are in no rush here (but it is super cool).
However, if others have alternative solutions, feel free to share.
as you want Julia compiled to JS, or just work in a browser? Escher already makes JS for you (you do not have to write it is CSS or HTML, as far as I understood). It’s just not arbitrary JS generated from Julia.
or asking about “server backend”? It has that, but not a possibility of a separate, e.g. Apache as Genie.jl does.
I’d like however to add one perspective I suspect a lot of non-technical people would share:
Being able to build a webapp for your package is a very attractive feature. It would be very useful to have some bare-bones, ultra simple, dumbed-down tutorial that includes some but not all of the components from this project. Maybe a simple sin plot with some input from the user?
My point is that there are scores of scientists that built some cool package they’d like to share in the form of a webapp, but very few of them built a webapp before. They (read: me) don’t know much about the terminology and parts involved in building and deploying a webapp. While this project demonstrates how this can be done, its level of complexity prevents these users from replicating it.
Imagine a template where the user could just replace the sin function with her own, adding or subtracting simple features, and following dumbed-down instructions on how to deploy it all on some standard server (e.g. aws). THAT would elevate the functionality of this effort tremendously!
I’ve been planning a package to do just this, and will try to have a minimal working package with a lot of documentation within the next week and a half. My eventual goal is that you should be able to call a single function like
microservice("my_fn", (x, y) -> x + 2*y)
and then be able to go to http://some.url/my_fn#?x=2?y=2 to get a JSON representation of the output. Doing this for base will be easy, but making it adaptable enough to work for arbitrary packages will be tricky.
To get the master branch by Pkg.clone("https://github.com/wookay/Bukdu.jl")
julia> importall Bukdu
julia> type CalculateController <: ApplicationController
julia> function my_fn(c::CalculateController)
q = c[:query_params]
x, y = map(v -> parse(Int, v), (q[:x], q[:y]))
render(JSON, x + 2*y)
my_fn (generic function with 1 method)
julia> Router() do
get("/my_fn", CalculateController, my_fn)
INFO Listening on http://127.0.0.1:8080
@yakir12 – A general method of deploying an API from within a notebook or the REPL will take a while longer, but https://github.com/amellnik/JuliaHerokuEndpoint now has a minimal but functional example as well as fairly detailed descriptions. If you have any trouble or if the instructions are unclear at any point please file and issue there and I would be glad to help.
Some very nice code and documentation in this thread.
For completeness, I will point out JuliaWebAPI.jl which allows you to expose any Julia function via ZMQ or HTTP transports. It’s a small but robust codebase, and has been used in production for many years.