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 Html5.D open Eliom_parameter module Example = Eliom_registration.App (struct let application_name = "example" end) let main = Eliom_service.service ~path:[] ~get_params:unit () let _ = Example.register ~service:main (fun () () -> Lwt.return (html (head (title (pcdata "Hello World of Ocsigen")) []) (body [h1 [pcdata "Hello World!"]; p [pcdata "Welcome to my first Ocsigen website."]])))
Now I guess you want to actually understand this code. You can:
- Have a look at How does a page's source code look?
- Or directly continue by compiling this code: How to compile my Ocsigen pages?
Download full code (recommended)
Links
