I need to write a very easy web application, in which I need to use Julia’s function. So I try to use Genie. To be honest, I don’t find good documentation, even the official doc isn’t full.
I wrote the simplest example. I need to understand how to work session variables.
using Genie, Genie.Router, Genie.Requests, Genie.Renderer.Html
function main()
i=1
route(“/test”) do
i = i+1
“test $i”
end
up()
end
main()
Would you suggest, how to create global variables for the session? Right now I have global variable for the whole site.
Thank you
P.S. Maybe you can suggest other libraries. Everything that I need, just to work with Get and Post request.
Hey, I hope you could already solve your problem. I dont have a good answer to your global variables, but a simple server setup which works fine for get and post could be:
import Genie: up
import Genie.Router: route, POST
import Genie.Requests: jsonpayload
function do_something()
jsonpayload()
end
function run_server()
route("/", () -> (:message => "Hey there!"))
route("/myroute", do_something, method=POST)
up(8000, async = false)
end