Reymaru
Reymaru

Reputation: 51

Julia as Server side

I need to make a web page where the input and the output is displayed, but the code where I "do stuff" must be in writing in Julia, how can I do this?.

to be clear, I want something like this:

 Web ----> Julia ----> Web
|input |  do stuff  | output

I don't know what I need to make this possible, I need any kind of Server-side?

I'm a very novice in programming, so I don't know how to search this on internet, I will be thankful with any help.

Upvotes: 2

Views: 3429

Answers (3)

essenciary
essenciary

Reputation: 401

If you need to accept input from the web and then output corresponding data after processing it with Julia, then definitely you need to use some form of server side Julia, since Julia does not run in the browser.

In terms of workflow, what you need is very simple:

1/ first, you need to display a form, to accept user input;

2/ second, the form needs to be POST-ed back to the server - where the data in the payload is processed;

3/ finally, you need to send back a response.

You can use a Julia framework like Genie (author of Genie writing this, btw) to have everything Julia in your stack - or you can use some other web stack (PHP, ruby, python, etc) for 1/ and 3/ and have a local Julia script process the data, invoked by the web scripts.

If you don't have experience developing web apps but have/need Julia skills, you're probably better off using Genie. It knows how to render HTML, it provides a nice MVC workflow, has a clear file structure and comes with some generators, does input sanitization in the persistence layer, etc. And it's very easy to accept input, add your data processing logic, and output your response.

But I must warn you that it's still very much work in progress - and this is visible in the state of the documentation (working on it, but boy this is time consuming). You can give it a try and open up issues in GitHub if you get stuck. Also, I would not recommend it for any mission critical apps yet - it needs more testing.

Upvotes: 4

aviks
aviks

Reputation: 2097

I will copy part of the answer from: How to make a GUI in Julia?, and add a few more.

  • If you are developing you code within an [Jupyter/IJulia] notebook, and need very simple interaction, such as slider to change some input values, the Interact package is the easiest thing to get started with.
  • To develop full fledged web UIs, take a look at Escher. Inspired by the Elm, it provides a functional library of UI components. Interactive web UIs are created in 100% Julia. There is no differentiation in code between the client and server sides. The framework handles all of that.
  • Another web framework worth looking at is Genie, which based on the traditional MVC design pattern. It also includes an ORM. An example of an application written in Genie is this listing of Julia packages: http://genieframework.com/packages
  • If you application is relatively simple, and you are happy working with a slightly lower level API, the Mux.jl middleware framework (which Escher uses) allow you to write simple handlers to http requests.
  • If you want to create cross platform desktop apps, but want to work with web technologies (i.e. HTML/CSS/Javascript), use Blink. This is a Julia wrapper around the Electron. You could potentially write an Escher or Genie application, and wrap in in Blink.jl to create a desktop app.

All of these packages are currently useful and well maintained. Unfortunately, some of the higher level frameworks in juliawebstack are no longer maintained.

Upvotes: 2

Chris Rackauckas
Chris Rackauckas

Reputation: 19132

In addition to the Julia webstack, you might want to look into Genie.jl. It's looking like a nice framework and was used to build this website.

Upvotes: 5

Related Questions