Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Eliom_registration.Unit

module Unit : 
with type page = unit
and type options = unit
and type return = Eliom_service.non_ocaml
and type result = browser_content kind

type page
type options
type return = Eliom_service.non_ocaml
type result

Service registration

val register : 
  ?app:string ->
  ?scope:[< Eliom_common.scope ] ->
  ?options:options ->
  ?charset:string ->
  ?code:int ->
  ?content_type:string ->
  ?headers:Cohttp.Header.t ->
  ?secure_session:bool ->
  service:('get, 'post, 'a, 'b, 'c, Eliom_service.non_ext,
   Eliom_service.reg, [< `WithSuffix | `WithoutSuffix ], 'd, 'e,
   Eliom_service.t ->
  ?error_handler:((string * exn) list ->
   page Lwt.t) ->
  ('get -> 'post -> page Lwt.t) -> unit

The function register ~service handler associates the service to the function handler. The handler function takes two parameters, the GET and POST parameters of the current HTTP request, and should return the corresponding page.

The optional parameter ~scope is Eliom_common.global_scope by default. See the Eliom manual for detailed description of different scopes.

The optional parameter ~options is specific to each output module. See the type description for more information.

The optional parameters ?charset, ?code, ?content_type and ?headers can be used to modify the HTTP answer sent by Eliom. Use this with care.

The optional parameter ~secure_session has no effect for scope Eliom_common.global_scope. With other scopes, the parameter is used to force the session service table in which the handler will be registered. By default, the service is registered in the non-secure session if the current request's protocol is http, or in the secure session if the protocol is https. If set to false (resp. true) the handler will be stored in the non-secure (resp. secure) session. See the Eliom manual for an introduction to secure state.

The optional parameter ~error_handler is used to specialize the error page when actual parameters aren't compatible with the expected type. The default error handler is fun l -> raise (Eliom_common.Eliom_Typing_Errorl).

val send : 
  ?options:options ->
  ?charset:string ->
  ?code:int ->
  ?content_type:string ->
  ?headers:Cohttp.Header.t ->
  page ->
  result Lwt.t

The function send page builds the HTTP frame corresponding to page. This may be used for example in a service handler registered with Eliom_registration.Any.register, or when building a custom output module.