package ez_api
Build not checkedInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=ed68e0a33325ecf6a3319cafa636d62e
sha512=425c6289d568cf697e8d9977ac43e2ebcdeec8f04f5a17225824d5a37ac700961e5d1283b92aeaebaf58ccfb5b4261bcba1180ab11c267ade0de86b68fd6ca2d
Description
Added to opam-repository:
README
ez_api : a simple library to write client/server web APIs
EzAPI is a collection of libraries and tools to handle APIs that can be installed with opam:
opam install ez_apiThe main package ez_api accessible via the module EzAPI defines services handling encoding (via json-data-encoding), errors, securites, and documentation.
Around this ez_api provides a multitude of sub-package, sometimes depending on optional libraries.
Encoding
ez_api proposes a small addition to json-data-encoding for easier coding (ez_api.encoding) and to avoid overflow when using js_of_ocaml (ez_api.encoding_js).
Client
ez_api implements client side requests for unix and web using different libraries. The main sub-package ez_api.req (or ez_api.req_lwt if you're using lwt) is a virtual implemetation that needs to be complemented with a implementation of your choice:
For unix:
- curl implementation
ez_api.icurlorez_api.icurl_lwtthat requires curl library:
opam depext ocurl
opam install ocurl- cohttp implementation
ez_api.icohttporez_api.icohttp_lwtthat requires tls and cohttp-lwt-unix libraries:
opam depext tls
opam install tls cohttp-lwt-unixFor web:
- javascript XHR implemenation
ez_api.ixhrorez_api.ixhr_lwt - cohttp web
ez_api.icoxhrorez_api.icoxhr_lwtthat requires cohttp-lwt-jsoo:
opam install cohttp-lwt-jsoo- fetch implemetation
ez_api.ifetchorez_api.ifetch_lwtrequiringezjs_fetch
opam install ezjs_fetchAll these implementation can also be used directly by removing the i preceding the sub-package name.
Websocket Client
As for the traditional client, ez_api provides a virtual implementation of a websocket client: ez_api.ws It can be complemented with:
- For unix the implementation
ez_api.ws_cohttprequires cohttp-lwt-unix and websocket-lwt-unix:
opam install cohttp-lwt-unix websocket-lwt-unix- For javascript
ez_api.ws_jsthat uses the native implementation of the browsers
Server
The server part (ez_api.server) requires more optional unix dependencies from geoip:
opam depext geoip
opam install calendar geoipAs for the client, the server has a virtual implementation (ez_api.server) that can be complemented with either cohttp or httpaf:
- for cohttp (
ez_api.iserver_cohttp), you will need cohttp-lwt-unix:
opam install cohttp-lwt-unix- for httpaf (
ez_api.iserver_httpaf), you will need httpaf-lwt-unix:
opam install httpaf-lwt-unixThese implementation can also be used directly by removing the i preceding the sub-package name.
If you need your server to handle websocket, you will need to install the corresponding dependencies:
- for cohttp server:
opam install websocket-lwt-unix- for httpaf server:
opam pin add websocket-httpaf.~dev git+https://github.com/anmonteiro/websocket-httpaf.git
opam pin add websocket-httpaf-lwt.~dev git+https://github.com/anmonteiro/websocket-httpaf.gitMore Tools
ez_api provides useful tools for server and client:
- server side sessions with different kind of authentication. (
ez_api.session,ez_api.session_client,ez_api.server_session) - recaptcha verification (
ez_api.recaptcha) - sending email via sendgrid (
ez_api.sendgrid) - exporting the documentation of your API to openapi-specs JSON (
ez_api.openAPI) - ppx rewriter (
ez_api.ppx) to simplify some server/handler registration
Documentation
The documentation for the different libraries can be found here: API Reference
Usage
Have a look at the files in test
Dependencies (6)
Dev Dependencies
None
Optional Dependencies (16)
Conflicts (12)
-
tls
>= "1.0.0" -
result
< "1.5" -
ppx_deriving_encoding
!= "0.3.0" -
ppxlib
< "0.18.0" | >= "0.36.0" -
digestif
< "1.0.0" -
ocurl
< "0.8.0" -
ezjs_fetch
< "0.2" -
httpaf-lwt-unix
< "0.6.0" -
cohttp-lwt-jsoo
< "5.0.0" -
cohttp-lwt-unix
< "5.0.0" -
js_of_ocaml-lwt
< "4.0.0" -
calendar
< "2.03"
Build status
Results of building ez_api with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
This version is not in the latest run; the versions below are.
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure