mirror of
https://github.com/zerotier/ratpack.git
synced 2026-05-22 16:27:23 -07:00
use ratpack::prelude::* in examples and readme
Signed-off-by: Erik Hollensbe <linux@hollensbe.org>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use http::{Request, Response, StatusCode};
|
||||
use hyper::Body;
|
||||
use ratpack::prelude::*;
|
||||
|
||||
async fn validate_authtoken(
|
||||
|
||||
@@ -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,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
@@ -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>,
|
||||
|
||||
Reference in New Issue
Block a user