3 releases

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

#1403 in HTTP server

Download history 6/week @ 2024-06-01 7/week @ 2024-06-08 1/week @ 2024-06-15 7/week @ 2024-06-29 5/week @ 2024-07-06 16/week @ 2024-07-13 44/week @ 2024-07-20 44/week @ 2024-07-27 45/week @ 2024-08-03 38/week @ 2024-08-10 62/week @ 2024-08-17 47/week @ 2024-08-24 40/week @ 2024-08-31

193 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

~28MB
~589K SLoC