Module Opium.Handler
Collection of handlers commonly used to build Opium applications
val serve : ?mime_type:string -> ?etag:string -> ?headers:Headers.t -> (unit -> (Body.t, [ Status.client_error | Status.server_error ]) Lwt_result.t) -> Rock.Handler.t
serve ?mime_type ?etag ?headers read
returns a handler that will serve the result ofread ()
.It is typically used to serve static file by providing a read function, either reading from the local filesystem, or from a remote one such as Amazon S3.
The response will contain an ETag header and a the HTTP code
304
will be returned if the computed ETag matches the one specified in the request.