mirror of
https://github.com/aantron/dream.git
synced 2025-08-25 00:02:41 -04:00
Sketch example/r-template
This commit is contained in:
parent
ab18ad938e
commit
802452e57e
12
example/r-template/README.md
Normal file
12
example/r-template/README.md
Normal 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
8
example/r-template/dune
Normal 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})))
|
1
example/r-template/dune-project
Normal file
1
example/r-template/dune-project
Normal file
@ -0,0 +1 @@
|
||||
(lang dune 2.0)
|
21
example/r-template/reason_template.eml.re
Normal file
21
example/r-template/reason_template.eml.re
Normal 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
|
Loading…
x
Reference in New Issue
Block a user