Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Opium.App
SourceAn opium app provides a set of convenience functions and types to construct a rock app.
An opium app is a simple builder wrapper around a rock app
A builder is a function that transforms an app
by adding some functionality. Builders are usuallys composed with a base app using (|>) to create a full app
A route is a function that returns a buidler that hooks up a handler to a url mapping
not_found
accepts a regular Opium handler that will be used instead of the default 404 handler.
any methods
will bind a route to any http method inside of methods
all methods
will bind a route to a URL regardless of the http method. You may escape the actual method used from the request passed.
Convert an opium app to a rock app
Start an opium server. The thread returned can be cancelled to shutdown the server
type body = [
| `Html of string
| `Json of Ezjsonm.t
| `Xml of string
| `String of string
| `Streaming of string Lwt_stream.t
]
Convenience functions for a running opium app
val urlencoded_pairs_of_body :
Opium_kernel.Rock.Request.t ->
(string * string list) list Lwt.t
Parse a request body encoded according to the application/x-www-form-urlencoded
content type (typically from POST requests with form data) into an association list of key-value pairs. An exception is raised on invalid data.
val respond :
?headers:Cohttp.Header.t ->
?code:Cohttp.Code.status_code ->
body ->
Opium_kernel.Rock.Response.t
val respond' :
?headers:Cohttp.Header.t ->
?code:Cohttp.Code.status_code ->
body ->
Opium_kernel.Rock.Response.t Lwt.t
val create_stream :
unit ->
(?headers:Cohttp.Header.t ->
?code:Cohttp.Code.status_code ->
unit Lwt.t ->
Opium_kernel.Rock.Response.t Lwt.t)
* (string ->
unit)