Using Julia on the web

By: Julia – Alex Mellnik

Re-posted from: http://alex.mellnik.net/using-julia-to-perform-calculations-on-a-web-site/

A fairly common problem is that you want to use Julia or another high level language to solve a problem, but also provide that solution to the world through a web site.  For Julia, you have a few different options:

  • Use Escher.jl.  This is a full-stack web server here pages are written in Julia.  It can do a lot of interesting things and is good for simple demos.  However, it is still in an early state, doesn’t play nicely with the existing web ecosystem, and has some performance issues.
  • Write the server-side code from scratch in Mux.jl.  This offers a lot more flexibility than Escher.jl, and could be used as a back-end along with static front end that uses your favorite tools.  However, it could lead to some extra overhead, especially if you already have server-side components.
  • Run an API from JuliaBox.  This is still somewhat experimental.
  • Use node-julia to call Julia directly from Node.js.  If you’re already using node, this seems like the best option at the moment.

Node-julia can be tricky to install and its syntax can seem arcane, but once you’re familiar with passing data back and forth between Javascript and Julia you can call your Julia code with minimal effort.  This winter I threw together a simple example here — index.js might look a bit complicated, but most of the code deals with handling an uploaded csv file.