Generic request body (#22)

Fixes #21
This commit is contained in:
David Pedersen
2021-06-19 12:50:33 +02:00
committed by GitHub
parent 6a16cd40ca
commit 356f1c8424
20 changed files with 692 additions and 401 deletions
+5 -2
View File
@@ -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();
}