Next: , Previous: , Up: Top   [Contents][Index]


12 Server endpoints

The disfluid server consists of a set of endpoints that handle requests. The (webid-oidc server endpoint) module defines the base building blocks.

Class: <endpoint> () host path

All endpoints define a host for which they are relevant, and an absolute path. If a request comes with a matching host and a matching path prefix, then it will be handled by this endpoint.

If host is #f, then this endpoint will be used for all hosts.

You can construct an endpoint with the #:host and #:path keyword arguments: the former is a string (defaults to #f), and the latter is a string starting with "/" (defaults to "/").

Generic: handle endpoint request request-body

Handle request with endpoint.

request is the request, in the form of an object from (web request). request-body is #f, a string or a bytevector.

Return 3 values: a response, a response body (a string, bytevector, input port, or #f if no body is expected), and some response meta-data.

Generic: host endpoint

Return the host name endpoint is configured to respond to.

Generic: path endpoint

Return the path prefix endpoint is configured to respond to.

Generic: relevant? endpoint request

Check if endpoint is configured to respond to request.

The handler may throw exceptions to signal errors. Exception messages will be printed to the log file, and user messages will be passed to the user.


Next: , Previous: , Up: Top   [Contents][Index]