I just want to share this new package Mongoose.jl I developed as a personal project to dig in into Julia, it can be used to build simple web apps. It is build on top of mongoose c library.
Developing an API rest is a simple as:
using Mongoose
function greet(conn; kwargs...)
mg_json_reply(conn, 200, "{\"message\":\"Hello World from Julia!\"}")
end
mg_register!("get", "/hello", greet)
mg_serve!()
# mg_shutdown!()
Why you prefix all functions with mg_ which to me is very ugly. I’d like to mark those public API using the public keyword instead of export, and if in case of confilicts, use import Mongoose as mg and simply do mg.serve!(), etc.
Correct, as @jd-foster mentioned I tried to keep the same naming style as the C library has. I hesitated to add the mg prefix but I did it to avoid collisions. Naming is hard.
I think a solution could be to use alias with public keyword for those exported functions (public serve! = mg_serve!)