usetokio::sync::oneshot;usesalvo_core::prelude::*;#[handler]asyncfnhello(res:&mutResponse){
res.render("Hello World!");}#[tokio::main]asyncfnmain(){let(tx, rx)=oneshot::channel();let router =Router::new().get(hello);let acceptor =TcpListener::new("127.0.0.1:5800").bind().await;let server =Server::new(acceptor).serve_with_graceful_shutdown(router,async{
rx.await.ok();},None);// Spawn the server into a runtimetokio::task::spawn(server);// Later, start the shutdown...let _ = tx.send(());}