pub async fn start_api_server(
addr: &str,
config: Arc<RwLock<Config>>,
) -> Result<()>Expand description
Start the API server for proxy management
This server provides REST endpoints for:
- GET /config - Get current configuration
- POST /config - Update configuration
- GET /health - Health check endpoint
§Arguments
addr- Address to listen on (e.g., “127.0.0.1:8081”)config- Shared configuration wrapped in Arc<RwLock>
§Example
let config = Arc::new(tokio::sync::RwLock::new(Config::from_file("config.caddy")?));
api::server::start_api_server("127.0.0.1:8081", config).await?;