let hello who =
let open Dream_html in
let open HTML in
html [] [
body [] [
h1 [] [txt "Hello, %s!" who];
];
]
let () =
Dream.run
@@ Dream.logger
@@ Dream.router [Dream.get "/" (fun _ -> Dream_html.respond (hello "world"))]
More examples shown below.
Note that the version of this library installed on your device may have outdated documentation strings. To view the latest documentation, please visit the repository page.
Forester_core types
These are the types of the final values which get rendered.
type attr
E.g. id="toast".
type node
Either a tag, a comment, or text data in the markup.
attr name is a new attribute which does not carry any payload. E.g.
let required = attr "required"
since 0.1.0.
val string_attr : string ->?raw:bool ->_string_attr
string_attr name fmt is a new string-valued attribute which allows formatting i.e. string interpolation of the value. Note, the fmt argument is required due to the value restriction.
Get whether a node is null (empty) or not. Useful for conditional rendering of UIs when you are passed in a node and you don't know if it's empty or not.
All standard HTML attributes and tags. Some attributes and tags have the same name, e.g. style. To disambiguate them, attributes have a _ (underscore) suffix.