eliascarv / webapi.jl Goto Github PK
View Code? Open in Web Editor NEWMake REST APIs quickly and simply.
Home Page: https://eliascarv.github.io/WebAPI.jl/
License: MIT License
Make REST APIs quickly and simply.
Home Page: https://eliascarv.github.io/WebAPI.jl/
License: MIT License
Hey @eliascarv ! What a cool project, I wish this existed 2 years ago!
Did you have any ideas about automatically hosting a documentation page? If you have an endpoint serving the JSON schema of your API, something like https://github.com/swagger-api/swagger-ui can automatically create an interactive docs page for your API!
Here is a python project using this same strategy: https://fastapi.tiangolo.com/#interactive-api-docs
You can use Base.Docs
to get docstrings, e.g.:
julia> b = Docs.Binding(Main, :sqrt)
Base.sqrt
julia> docs = Base.Docs.doc(b);
julia> repr(MIME"text/html"(), docs)
"<div class=\"markdown\"><pre><code>sqrt(x)</code></pre>\n<p>Return $\\sqrt{x}$. Throws <a href=\"@ref\"><code>DomainError</code></a> for negative <a href=\"@ref\"><code>Real</code></a> arguments. Use complex negative arguments instead. The prefix opera" ⋯ 2878 bytes ⋯ "95(87)90118-2</a></p>\n</div>\n<h1>Examples</h1>\n<pre><code class=\"language-jldoctest\">julia> A = [4 0; 0 4]\n2×2 Matrix{Int64}:\n 4 0\n 0 4\n\njulia> sqrt(A)\n2×2 Matrix{Float64}:\n 2.0 0.0\n 0.0 2.0</code></pre>\n\n\n</div>"
I'm looking forward to see where this package goes! Consider posting a TODO list on your README, or keeping issues with good labels, to let people know how ready-to-use the package is, and in what ways they could contribute!
You might want to add end-to-end tests where you run the API server with serve(app)
, and use HTTP.get("http://localhost:2345/hello")
to make real requests to your own server. This requires some tricky async code, but this example from Pluto's tests might be helpful:
Notice that we use polling instead of sleep
to deal with the unpredictable nature of running code in the background. The poll
function is here, feel free to copy:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.