smart-house-web: в работе

This commit is contained in:

View File

@@ -23,7 +23,10 @@ pub fn run_server() {
exit(crate::CODE_TOKIO_RUNTIME_CREATION_ERROR); exit(crate::CODE_TOKIO_RUNTIME_CREATION_ERROR);
} }
}; };
runtime.block_on(async { runtime.block_on(server_main());
}
async fn server_main() {
let app = axum::Router::new().fallback(fallback); let app = axum::Router::new().fallback(fallback);
let addr = "127.0.0.1:8080"; let addr = "127.0.0.1:8080";
let listener = match tokio::net::TcpListener::bind(addr).await { let listener = match tokio::net::TcpListener::bind(addr).await {
@@ -42,7 +45,6 @@ pub fn run_server() {
exit(crate::CODE_STARTIG_SERVER_ERROR); exit(crate::CODE_STARTIG_SERVER_ERROR);
}; };
info!("Shutdown server"); info!("Shutdown server");
});
} }
async fn fallback() -> axum::response::Response { async fn fallback() -> axum::response::Response {