fix: docs test

This commit is contained in:
藍+85CD 2024-07-25 17:45:28 +08:00
parent 61d95ec3e9
commit b59c9c45fa
No known key found for this signature in database
GPG key ID: BCB0111111111111
2 changed files with 8 additions and 8 deletions

View file

@ -91,7 +91,7 @@ moka = { version = "0.12.8", features = ["future"] }
axum = { version = "0.7.5", features = [
"json",
], default-features = false, optional = true }
axum-extra = { version = "0.9.3", optional = true }
axum-extra = { version = "0.9.3", features = ["typed-header"], optional = true }
tower = { version = "0.4.13", optional = true }
hyper = { version = "1.4.1", optional = true }
http-body-util = { version = "0.1.2", optional = true }

View file

@ -15,9 +15,9 @@ The next step is to allow other servers to fetch our actors and objects. For thi
# use activitypub_federation::config::FederationMiddleware;
# use axum::routing::get;
# use crate::activitypub_federation::traits::Object;
# use axum::headers::ContentType;
# use axum_extra::headers::ContentType;
# use activitypub_federation::FEDERATION_CONTENT_TYPE;
# use axum::TypedHeader;
# use axum_extra::TypedHeader;
# use axum::response::IntoResponse;
# use http::HeaderMap;
# async fn generate_user_html(_: String, _: Data<DbConnection>) -> axum::response::Response { todo!() }
@ -33,11 +33,11 @@ async fn main() -> Result<(), Error> {
.route("/user/:name", get(http_get_user))
.layer(FederationMiddleware::new(data));
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
tracing::debug!("listening on {}", addr);
axum::Server::bind(&addr)
.serve(app.into_make_service())
.await?;
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000")
.await
.unwrap();
tracing::debug!("listening on {}", listener.local_addr().unwrap());
axum::serve(listener, app).await.unwrap();
Ok(())
}