package resto
Install
Dune Dependency
Authors
Maintainers
Sources
md5=394275a7579c7dbcb29631b447006253
sha512=20f7d3ee730b4b202707ec7802662733ec2e3db76a7be78d4f794eb22796d8fc54e3e16e5a8e2fff80b391ea84cfbe470044772b815eebfd389d0a6754e1df85
doc/resto/Resto/index.html
Module Resto
Source
Resto
Resto is a library for defining, serving, and querying a REST directory of RPC services.
Overview of Resto
Resto is a library for describing *services*. A service is the entry-point in an API: a URI/URL with some path parameters (some of the slash-separated segments are actually decoded as parameters), some additional query parameters (the part that looks like ?utm_parameter=from_email
in the links of marketing emails) and other attributes depending on the method of the service.
For example, you can use Resto to describe the directory of services that, as a whole, forms the API for a web-service. You can then use one of the other resto packages to implement a server that answers requests made to this API. Alternatively, you can use one of the other resto packages to make your program query such an API.
Intended use of Resto
The intended use of Resto
is as follows:
- Define arguments, paths, query fields, and queries as required by the API you describe.
- Define services using the previously defined arguments, paths, query fields and queries.
- Use
Resto_directory
to register those services.
If you are writing a server, you can then:
- Use
Resto_cohttp_server.
Server
to spin up a server that answers requests to these services.
Alternatively, if you are writing a client, you can then:
- Use
Resto_cohttp_client.
Client
to make requests to these services.
And of course you can do both if you are writing both the server and the client.
The different methods that a service can be used by a service.
eq
is an equality witness type. It is returned by some non-trivial equality-testing functions in the rest of this module. In general, it is intended to be used as follows:
match are_equal foo bar with | None -> (* values are not equal *) .. | Some Eq -> (* values are equal *) ..
Service directory description
Query parameters are the key-value pairs that appear as ?key0=value0&key1=value1&..
at the end of the path in URIs/URLs.
An ENCODING
is a generic interface for modules that provide conversion from values to a different representation and back. This is used to abstract resto over specific representations of values.
Services.