3 releases

0.1.2 Jun 8, 2021
0.1.1 Jun 8, 2021
0.1.0 Jun 8, 2021

#1588 in HTTP server

Download history 1/week @ 2024-11-13 6/week @ 2024-11-20 11/week @ 2024-11-27 7/week @ 2024-12-04 11/week @ 2024-12-11 13/week @ 2025-01-15 48/week @ 2025-01-22 17/week @ 2025-01-29 6/week @ 2025-02-05 4/week @ 2025-02-12 20/week @ 2025-02-19 28/week @ 2025-02-26

62 downloads per month

MIT/Apache

8KB
117 lines

actix-web-pagination

Pagination extractor for actix-web.

Example

use actix_web::{App, HttpResponse, HttpServer};
use actix_web_pagination::Pagination;

#[actix_web::get("/")]
async fn list(page: Pagination) -> HttpResponse {
    println!("page: {:?}", page);
    HttpResponse::Ok().finish()
}

#[actix_web::main]
async fn main() -> actix_web::Result<()> {
    HttpServer::new(|| {
        App::new()
            .data(Pagination::config().default_per_page(50))
            .service(list)
    })
    .bind("0.0.0.0:8080")?
    .run()
    .await?;

    Ok(())
}

License

Apache or MIT


lib.rs:

Extract pagination from http request

Example

use actix_web::{App, HttpResponse, HttpServer};
use actix_web_pagination::Pagination;

#[actix_web::get("/")]
async fn list(page: Pagination) -> HttpResponse {
    println!("page: {:?}", page);
    HttpResponse::Ok().finish()
}

#[actix_web::main]
async fn main() -> actix_web::Result<()> {
    HttpServer::new(|| {
        App::new()
            .data(Pagination::config().default_per_page(50))
            .service(list)
    })
    .bind("0.0.0.0:8080")?
    .run()
    .await?;

    Ok(())
}

Dependencies

~31MB
~629K SLoC