Oxygen.jl: A breath of fresh air for programming web apps in Julia
forem.julialang.org
forem.julialang.org
I still think there's a LOOONGGG way to go for Julia web frameworks, and specifically here there's auth / cookie handling / supporting static assets etc and a number of features I'd like to see enabled as plugins or add ons (not unlike flask). But for now, it seems like a great start.
I am not a fan of web frameworks that require defining the path of a handler where the handler is defined. I feel like this is something that is nice if you have a very small project, but makes it difficult to understand the api surface as a project gets larger and things start being abstracted. Even though you have to parse out your own url params, I would likely choose HTTP.jl over another abstraction.
When we switched to spring annotation driven configuration it was a breath of fresh air. The mapping of http verbs, params etc. were all colocated with the services and there was no need to keep jumping across files.
Very few people may use sinatra now, but its spirit will live on among countless frameworks that have embraced its minimalism to whatever extent their host platform allow.
How do you normally think about making that information discoverable in your webapps?
I usually prefer a code-first approach and the open source tooling is able to extract the spec for me from annotations - which becomes a centralized location for exploration or generating clients.
Oxygen.jl supports several different design styles and leaves the choice up to the developer.
- Central file with routes & import request handlers from other modules
- Define routes & handlers across multiple modules and just call serve() from the main module
Below is a quick example of how you could separate your application logic from any routing logic
------- B.jl -------
module B
export greet
function greet()
"hello world!"
end
end
------- main.jl ------- module Main
using Oxygen
include("B.jl"); using .B
@get "/hello" greet
serve()
end> most people don't need all features that come with these heavyweight packages
Why not contribute to Genie.jl an interface that is simpler then?
Edit: I removed HTTP.jl from the list as it is a lower-level library with a different set of constraints to interoperability.
Agree with you in general, but in this particular case, I am glad there is an alternative to Genie.jl.