diff --git a/README.md b/README.md index 9649d02..418a711 100644 --- a/README.md +++ b/README.md @@ -26,16 +26,14 @@ Add these dependencies to your `Cargo.toml` file. [dependencies] hyper-reverse-proxy = "0.5" hyper = { version = "0.14", features = ["full"] } -tokio = { version = "0.3", features = ["full"] } +tokio = { version = "1", features = ["full"] } ``` The following example will set up a reverse proxy listening on `127.0.0.1:13900`, and will proxy these calls: * `"/target/first"` will be proxied to `http://127.0.0.1:13901` - * `"/target/second"` will be proxied to `http://127.0.0.1:13902` - * All other URLs will be handled by `debug_request` function, that will display request information. ```rust,no_run @@ -52,8 +50,8 @@ fn debug_request(req: Request) -> BoxFut { Box::new(future::ok(response)) } +#[tokio::main] fn main() { - // This is our socket address... let addr = ([127, 0, 0, 1], 13900).into(); @@ -78,13 +76,12 @@ fn main() { }) }); - let server = Server::bind(&addr) - .serve(make_svc) - .map_err(|e| eprintln!("server error: {}", e)); - + let server = Server::bind(&addr).serve(make_svc); + + // Run this server for... forever! println!("Running server on {:?}", addr); - - // Run this server for... forever! - hyper::rt::run(server); + if let Err(e) = server.await { + eprintln!("server error: {}", e); + } } ``` diff --git a/src/lib.rs b/src/lib.rs index e34cd0d..e6c0ec2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,8 +18,8 @@ //! ```toml //! [dependencies] //! hyper-reverse-proxy = "0.5" -//! hyper = "0.13" -//! tokio = { version = "0.2", features = ["full"] } +//! hyper = { version = "0.14", features = ["full"] } +//! tokio = { version = "1", features = ["full"] } //! ``` //! //! The following example will set up a reverse proxy listening on `127.0.0.1:13900`,