Skip to main content

serve_with_config

Function serve_with_config 

Source
pub async fn serve_with_config(
    app: App,
    config: ServerConfig,
) -> Result<(), ServeError>
Expand description

Convenience function to serve an App with custom configuration.

§Example

use fastapi::prelude::*;
use fastapi_http::{serve_with_config, ServerConfig};

let app = App::builder()
    .get("/", |_, _| async { Response::ok() })
    .build();

let config = ServerConfig::new("0.0.0.0:8080")
    .with_max_connections(500);

serve_with_config(app, config).await?;