aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-04-03 09:26:14 +0000
committerFuwn <[email protected]>2022-04-03 09:26:14 +0000
commit28c18278b66751842c6feb3c3d6099f40159b235 (patch)
tree5365caa43371fa86a2045be60bee679b8acd9521 /examples
parentdocs(cargo): bump version to 0.1.8 (diff)
downloadwindmark-28c18278b66751842c6feb3c3d6099f40159b235.tar.xz
windmark-28c18278b66751842c6feb3c3d6099f40159b235.zip
feat(router): allow multiple headers and footers
Diffstat (limited to 'examples')
-rw-r--r--examples/windmark.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/windmark.rs b/examples/windmark.rs
index dc69bbe..5cbdf9f 100644
--- a/examples/windmark.rs
+++ b/examples/windmark.rs
@@ -86,13 +86,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
stream.peer_addr().unwrap().ip()
)
}))
- .set_header(Box::new(|_| "```\nART IS COOL\n```".to_string()))
- .set_footer(Box::new(|_| "Copyright 2022".to_string()))
+ .add_header(Box::new(|_| "```\nART IS COOL\n```\nhi".to_string()))
+ .add_footer(Box::new(|_| "Copyright 2022".to_string()))
+ .add_footer(Box::new(|context| {
+ format!("Another footer, but lower! (from {})", context.url.path())
+ }))
.mount(
"/",
Box::new(|_| {
Response::Success(
- "# INDEX\n\nWelcome!\n\n=> /test Test Page\n=> /time Unix Epoch\n"
+ "# INDEX\n\nWelcome!\n\n=> /test Test Page\n=> /time Unix Epoch"
.to_string(),
)
}),