diff options
Diffstat (limited to 'examples/warp.rs')
| -rw-r--r-- | examples/warp.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/warp.rs b/examples/warp.rs new file mode 100644 index 0000000..c705b47 --- /dev/null +++ b/examples/warp.rs @@ -0,0 +1,14 @@ +use warp::Filter; + +#[tokio::main] +async fn main() { + let hello = warp::path!("hello" / String) + .map(|name| format!("Hello, {}!", name)); + let health = warp::path!(".within" / "health") + .map(|| "OK"); + let routes = hello.or(health); + + warp::serve(routes) + .run(([0, 0, 0, 0], 3030)) + .await; +} |
