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

How to make a "hello world" in Ocsigen?

Here it is! The famous "Hello World" for a client/server Eliom application:

open Eliom_content
open Html.D
open Eliom_parameter

module Example =
  Eliom_registration.App
    (struct
      let application_name = "example"
     end)

let main =
  Eliom_service.create
    ~path:(Eliom_service.Path [])
    ~meth:(Eliom_service.Get unit)
    ()

let _ =

  Example.register
    ~service:main
    (fun () () ->
      Lwt.return
	(html
	   (head (title (txt "Hello World of Ocsigen")) [])
	   (body [h1 [txt "Hello World!"];
		  p [txt "Welcome to my first Ocsigen website."]])))

Links