X-Git-Url: https://piware.de/gitweb/?p=learn-rust.git;a=blobdiff_plain;f=warp-server%2Fsrc%2Fmain.rs;fp=warp-server%2Fsrc%2Fmain.rs;h=1c75e734d32aca6e9552489815a19eb31d537e59;hp=f4983e73ed45895573a7ca16dbf11459a4ac0348;hb=832becf96c3d541c5e50af26f5ddadbec26fd9e8;hpb=05975f1d5fcc331c82f3b9786a5f4afbc027d4cd diff --git a/warp-server/src/main.rs b/warp-server/src/main.rs index f4983e7..1c75e73 100644 --- a/warp-server/src/main.rs +++ b/warp-server/src/main.rs @@ -3,6 +3,8 @@ use warp::Filter; #[tokio::main] async fn main() { + env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); + // GET /hello/warp => 200 OK with body "Hello, warp!" let hello = warp::path!("hello" / String) .and(warp::header::("user-agent")) @@ -23,7 +25,11 @@ async fn main() { }) }); - warp::serve(hello.or(echo)) + let api = hello + .or(echo) + .with(warp::log("warp-server")); + + warp::serve(api) .run(([127, 0, 0, 1], 3030)) .await; }