Crates.io | actix-web-pagination |
lib.rs | actix-web-pagination |
version | 0.1.2 |
source | src |
created_at | 2021-06-08 13:55:17.31261 |
updated_at | 2021-06-08 15:08:22.781606 |
description | Pagination extractor for actix-web |
homepage | |
repository | https://github.com/arniu/kepton |
max_upload_size | |
id | 407820 |
size | 20,862 |
actix-web-pagination
Pagination extractor for actix-web
.
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(())
}