update examples

This commit is contained in:
David Pedersen
2022-07-03 21:47:23 +02:00
parent 02f9ebaee9
commit 16ef59b6ce
38 changed files with 101 additions and 83 deletions
+3 -3
View File
@@ -5,7 +5,7 @@
//! ```
use axum::{
routing::{get, post},
routing::{get, post, WithState},
Json, Router,
};
use tower_http::trace::TraceLayer;
@@ -34,8 +34,8 @@ async fn main() {
/// Having a function that produces our app makes it easy to call it from tests
/// without having to create an HTTP server.
#[allow(dead_code)]
fn app() -> Router {
Router::new()
fn app() -> Router<(), WithState> {
Router::without_state()
.route("/", get(|| async { "Hello, World!" }))
.route(
"/json",