refactor: remove tokio TcpListener and simplify address setup

- Replaced `tokio::net::TcpListener` with direct `SocketAddr` setup.
- Simplified server address configuration while maintaining functionality.
- Reduced unnecessary dependencies for cleaner API handling.
This commit is contained in:
Harald Hoyer 2025-03-20 15:49:38 +01:00
parent 5c0dcdb97a
commit fbc8e689d4

View file

@ -9,7 +9,6 @@ use axum::{
};
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use tokio::net::TcpListener;
use tracing::{info, error, debug, instrument};
use crate::document_service::{Document, DocumentService, SignatureVerification};
@ -106,12 +105,8 @@ pub async fn start_api(
info!("API routes configured");
// Start server
let listener = TcpListener::bind(format!("0.0.0.0:{}", api_port)).await?;
info!("API server started on port {}", api_port);
// Get the socket address
let addr = listener.local_addr()?;
let addr = std::net::SocketAddr::from(([0, 0, 0, 0], api_port));
// Bind and serve
info!("Serving API at {}", addr);