use ratpack::prelude::* in examples and readme

Signed-off-by: Erik Hollensbe <linux@hollensbe.org>
This commit is contained in:
Erik Hollensbe
2022-01-22 14:06:30 -08:00
parent 1ea434376c
commit a7ae4c2c26
5 changed files with 4 additions and 14 deletions
+1 -3
View File
@@ -17,9 +17,7 @@ Here is an example which carries global _application state_ as an authentication
**Note:** this is available at [examples/auth-with-state.rs](examples/auth-with-state.rs). It can also be run with cargo: `cargo run --example auth-with-state`.
```rust
use http::{Request, Response, StatusCode};
use hyper::Body;
use ratpack::{app::App, compose_handler, handler::Params, Error, HTTPResult, ServerError};
use ratpack::prelude::*;
// our authtoken validator, this queries the app state and the header
// `X-AuthToken` and compares the two. If there are any discrepancies, it
-2
View File
@@ -1,5 +1,3 @@
use http::{Request, Response, StatusCode};
use hyper::Body;
use ratpack::prelude::*;
async fn validate_authtoken(
+1 -3
View File
@@ -1,6 +1,4 @@
use http::{Request, Response, StatusCode};
use hyper::Body;
use ratpack::{app::App, compose_handler, Error, HTTPResult, Params, ServerError};
use ratpack::prelude::*;
const DEFAULT_AUTHTOKEN: &str = "867-5309";
const AUTHTOKEN_FILENAME: &str = "authtoken.secret";
+1 -3
View File
@@ -1,6 +1,4 @@
use http::{Request, Response};
use hyper::Body;
use ratpack::{app::App, compose_handler, HTTPResult, Params, ServerError};
use ratpack::prelude::*;
async fn hello(
req: Request<Body>,
+1 -3
View File
@@ -1,7 +1,5 @@
use http::{Request, Response};
use hyper::Body;
use log::LevelFilter;
use ratpack::{app::App, compose_handler, HTTPResult, Params, ServerError};
use ratpack::prelude::*;
async fn log(
req: Request<Body>,