mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-25 00:00:23 +02:00
@@ -58,7 +58,10 @@ async fn main() {
|
||||
// Run our app with hyper
|
||||
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
|
||||
tracing::debug!("listening on {}", addr);
|
||||
app.serve(&addr).await.unwrap();
|
||||
hyper::Server::bind(&addr)
|
||||
.serve(app.into_make_service())
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
type SharedState = Arc<RwLock<State>>;
|
||||
@@ -98,7 +101,7 @@ async fn list_keys(Extension(state): Extension<SharedState>) -> String {
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
fn admin_routes() -> BoxRoute {
|
||||
fn admin_routes() -> BoxRoute<hyper::Body> {
|
||||
async fn delete_all_keys(Extension(state): Extension<SharedState>) {
|
||||
state.write().unwrap().db.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user