Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

w-mlx


mlx, an OCaml syntax dialect which adds JSX expressions, can be used with Dream for generating HTML.

let greet ~who () =
  <html>
    <head>
      <title>"Greeting"</title>
    </head>
    <body>
      <h1>"Good morning, " (JSX.string who) "!"</h1>
    </body>
  </html>

let () =
  Dream.run
  @@ Dream.logger
  @@ Dream.router [
    Dream.get "/" (fun _ ->
      let html = JSX.render <greet who="world" /> in
      Dream.html html)
  ]
$ cd example/w-mlx
$ opam install --deps-only --yes .
$ dune exec --root . ./mlx.exe

Up to the example index