diff --git a/src/main.rs b/src/main.rs index cf020b0..93e764b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,10 +46,16 @@ async fn main() { let app = Router::new().route("/", get(root_get)).with_state(state); + let quit_signal = async { + _ = tokio::signal::ctrl_c().await; + eprintln!("Initializing graceful shutdown"); + }; + let addr = "0.0.0.0:8080".parse().unwrap(); info!("Listening on {addr}"); axum::Server::bind(&addr) .serve(app.into_make_service()) + .with_graceful_shutdown(quit_signal) .await .unwrap(); }