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

How to register a service that decides itself what to send?

Use Eliom.Registration.Any.

In the following example, we send an Html page or a redirection:

let send_any =
  Eliom.Registration.Any.create
    ~path:(Eliom.Service.Path ["any"])
    ~meth:(Eliom.Service.Get (string "s"))
   (fun s () ->
     if s = "toto"
     then
       Eliom.Registration.Html.send
         (html
            (head (title (txt "")) [])
            (body [p [txt "Hello."]]))
     else
       Eliom.Registration.Redirection.send other_service)