diff options
| author | Fuwn <[email protected]> | 2022-04-03 09:26:14 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-04-03 09:26:14 +0000 |
| commit | 28c18278b66751842c6feb3c3d6099f40159b235 (patch) | |
| tree | 5365caa43371fa86a2045be60bee679b8acd9521 /examples | |
| parent | docs(cargo): bump version to 0.1.8 (diff) | |
| download | windmark-28c18278b66751842c6feb3c3d6099f40159b235.tar.xz windmark-28c18278b66751842c6feb3c3d6099f40159b235.zip | |
feat(router): allow multiple headers and footers
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/windmark.rs | 9 |
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(), ) }), |