diff options
Diffstat (limited to 'examples/windmark.rs')
| -rw-r--r-- | examples/windmark.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/examples/windmark.rs b/examples/windmark.rs index 687704d..0cdecd5 100644 --- a/examples/windmark.rs +++ b/examples/windmark.rs @@ -80,22 +80,22 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { r.mount("/module", success!("This is a module!")); }); router.attach_async(Clicker::default()); - // router.set_pre_route_callback(|context| { - // info!( - // "accepted connection from {} to {}", - // context.tcp.peer_addr().unwrap().ip(), - // context.url.to_string() - // ) - // }); - // router.set_post_route_callback(|context, content| { - // content.content = - // content.content.replace("Welcome!", "Welcome to Windmark!"); - // - // info!( - // "closed connection from {}", - // context.tcp.peer_addr().unwrap().ip() - // ) - // }); + router.set_pre_route_callback(|context| { + info!( + "accepted connection from {} to {}", + context.peer_address.unwrap().ip(), + context.url.to_string() + ) + }); + router.set_post_route_callback(|context, content| { + content.content = + content.content.replace("Welcome!", "Welcome to Windmark!"); + + info!( + "closed connection from {}", + context.peer_address.unwrap().ip() + ) + }); router.add_header(|_| "```\nART IS COOL\n```\nhi".to_string()); router.add_footer(|_| "Copyright 2022".to_string()); router.add_footer(|context| { |