You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ocaml-dispatch provides a basic mechanism for dispatching a request to a
handler based on hierarchical path names conventionally found in URIs. It can be
used both for dispatching requests in a server, as well as handing changes to
hierarchical fragments in a client-side application.
To install development versions of the library, pin the package from the root
of the repository:
opam pin add .
You can install the latest changes by commiting them to the local git
repository and running:
opam upgrade dispatch
For building and running the tests during development, you will need to install
the alcotest package and reconfigure the build process to enable tests:
opam install alcotest
dune runtest
Usage
Dispatch is designed to work with whatever sort of handler you care to use,
whether it's synchronous, Lwt-based, or Async-based. Here's a simple example of
using the Dispatch.DSL module to setup routing for a "Hello, World!" server.
The example assumes a Server module and request type, and that handlers
should return strings that will be interpreted as the body of the response.