Module actix

Module actix 

Source
Expand description

Actix-web integration module.

Provides pre-built handlers and helpers for Actix-web 4.x.

§Quick Start

use actix_web::{App, HttpServer, web};
use html2pdf_api::prelude::*;
use html2pdf_api::integrations::actix::configure_routes;

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    let pool = init_browser_pool().await.unwrap();

    HttpServer::new(move || {
        App::new()
            .app_data(web::Data::new(pool.clone()))
            .configure(configure_routes)
    })
    .bind("127.0.0.1:8080")?
    .run()
    .await
}

§Available Exports

ExportDescription
configure_routesConfigure 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>>
BrowserPoolDataType alias for web::Data<SharedBrowserPool>
BrowserPoolActixExtExtension trait for BrowserPool

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

Re-exports§

pub use crate::integrations::actix::*;