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."]])))- To understand this code, 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?