Sketch example/r-template

This commit is contained in:
Anton Bachin 2021-03-29 00:01:35 +03:00
parent ab18ad938e
commit 802452e57e
4 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# `r-template`
<br>
**Next steps:**
<br>
[Up to the tutorial index](../#readme)
<!-- TODO OWASP link; injection general link. -->
<!-- TODO Link to template syntax reference. -->

8
example/r-template/dune Normal file
View File

@ -0,0 +1,8 @@
(executable
(name reason_template)
(libraries dream))
(rule
(targets reason_template.re)
(deps reason_template.eml.re)
(action (run dream_eml %{deps} --workspace %{workspace_root})))

View File

@ -0,0 +1 @@
(lang dune 2.0)

View File

@ -0,0 +1,21 @@
let render = param => {
<html>
<body>
<h1>The URL parameter was <%s param %>!</h1>
</body>
</html>
};
let () =
Dream.run
@@ Dream.logger
@@ Dream.router([
Dream.get("/:word",
(request =>
Dream.param("word", request)
|> render
|> Dream.respond)),
])
@@ Dream.not_found