Request for example: "Hello world [name]" as a web app, aka how to pass to Julia the inputs of a web form and retrieve the output as a html response

I need to expose a Julia function as a web app, where users fill a simple (static?) html form with a couple of input fields and a file input (for a csv file) and the “web app” responds with a string to be formatted as a html page to be shown to the user.
Which is the simplest way to achieve that ? I already have apache running on the server, does some sort of mod_julia exists? Or like in the perl/cgi era ? Or one need to run a julia-specific server (this would be my least desired method, as it implies I need to have the julia server running all the time, while this app is gonna to be used rarely) ? Does a complete “Hello world [name]” example exists from which to expand ?

I don’t care if the user has to wait a few seconds for the script to JIT compile…

I am learning how to do it with Genie… do you think it would be the best approach for my user case or it is like using a nuclear bomb to remove a stump ?

1 Like

With Genie I am now doing…

using Genie, Genie.Router, Genie.Renderer.Html, Genie.Requests, CSV, DataFrames
form = """
<form action="/" method="POST" enctype="multipart/form-data">
  <label for="dataFile">Data file (CSV): </label><input type="file" name="dataFile" />
  <br/><input type="submit" value="Find environmental efficiency scores" />
</form>
"""
route("/") do
  html(form)
end

route("/", method = POST) do
  if infilespayload(:dataFile)
    write(filespayload(:dataFile))
    csvcontent = CSV.read(filename(filespayload(:dataFile)),DataFrame; delim=';',copycols=true)
   # [... work on the dataframe...]
  else
    "No data file uploaded"
  end
end

up()

Is there a way to avoid writing the file ?