Module axum

Module axum 

Source
Expand description

Axum integration module.

Provides pre-built handlers and router for Axum 0.7.x/0.8.x.

§Quick Start

use html2pdf_api::prelude::*;
use html2pdf_api::integrations::axum::router;

#[tokio::main]
async fn main() {
    let pool = init_browser_pool().await.unwrap();

    let app = router().with_state(pool);

    let listener = tokio::net::TcpListener::bind("127.0.0.1:8080")
        .await
        .unwrap();
    axum::serve(listener, app).await.unwrap();
}

§Available Exports

ExportDescription
routerCreate router with all pre-built routes
pdf_from_urlHandler for URL-to-PDF
pdf_from_htmlHandler for HTML-to-PDF
pool_statsHandler for pool statistics
health_checkHandler for health check
readiness_checkHandler for readiness check
SharedPoolType alias for Arc<Mutex<BrowserPool>>

See crate::integrations::axum for full documentation.

Re-exports§

pub use crate::integrations::axum::*;