Skip to content
A REST toolkit for OCaml
OCaml Other
  1. OCaml 99.8%
  2. Other 0.2%
Branch: master
Clone or download

Latest commit

seliopou Merge pull request #104 from inhabitedtype/choose-encoding
choose-encoding: move choosing encoding code to Encoding module
Latest commit 2e4f009 Apr 25, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Build examples with dune Mar 11, 2019
lib choose-encoding: move choosing encoding code to Encoding module Apr 25, 2020
lib_test Upgrade to dune Mar 11, 2019
.gitignore switch to jbuilder Aug 1, 2017
.travis-examples.sh Build examples with dune Mar 11, 2019
.travis.yml travis: further fixes Nov 23, 2018
CONTRIBUTING.md Upgrade to dune Mar 11, 2019
LICENSE LICENSE.md -> LICENSE Sep 16, 2017
META.webmachine.template Merge github.com:inhabitedtype/ocaml-webmachine Sep 13, 2017
Makefile Upgrade to dune Mar 11, 2019
README.md Build examples with dune Mar 11, 2019
dune-project Upgrade to dune Mar 11, 2019
webmachine.opam pr95: remove build annotation from dune dependency Apr 18, 2020

README.md

ocaml-webmachine

ocaml-webmachine is a layer on top of cohttp that implements a state-machine-based HTTP request processor. It's particularly well-suited for writing RESTful APIs. As the name suggests, this is an OCaml port of the webmachine project.

Build Status

Installation

Install the library and its depenencies via OPAM:

opam install webmachine

Getting Started

webmachine implements this decision diagram to determine how an HTTP request should be handled. This includes validation, authentication, content negotiation, and caching. A resource specifies the decision that should be made at each node in the diagram by defining the appropriate method in a resource subclass. The correspondence is suggested by the name of the method for now. This will be better-documented in the future.

Examples

To build the examples in the examples/ subdirectory:

dune build examples/hello_lwt.exe
dune build examples/crud_lwt.exe
dune build examples/hello_async.exe

Development

To install development dependencies, pin the package from the root of the repository:

opam pin add -n webmachine .
opam install --deps-only webmachine

After this, you may install a development version of the library using the install command as usual.

For building and running the tests during development, you will need to install the oUnit package and run tests:

opam install oUnit
dune runtest

License

BSD3, see LICENSE file for its text.

You can’t perform that action at this time.