| Crates.io | prax-actix |
| lib.rs | prax-actix |
| version | 0.5.0 |
| created_at | 2025-12-21 17:54:39.864081+00 |
| updated_at | 2026-01-07 18:35:28.865588+00 |
| description | Actix-web framework integration for Prax ORM |
| homepage | https://github.com/pegasusheavy/prax-orm |
| repository | https://github.com/pegasusheavy/prax-orm |
| max_upload_size | |
| id | 1998393 |
| size | 101,277 |
Actix-web framework integration for Prax ORM.
prax-actix provides middleware and extractors for the Actix-web framework.
PraxMiddleware for request handlingDatabaseConnection FromRequest extractoruse actix_web::{web, App, HttpServer};
use prax_actix::{PraxClientBuilder, DatabaseConnection};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let prax = PraxClientBuilder::new()
.url("postgresql://localhost/mydb")
.build()
.await
.unwrap();
HttpServer::new(move || {
App::new()
.app_data(web::Data::new(prax.clone()))
.route("/users", web::get().to(list_users))
})
.bind("127.0.0.1:8080")?
.run()
.await
}
async fn list_users(db: DatabaseConnection) -> impl Responder {
let users = db.user().find_many().exec().await.unwrap();
HttpResponse::Ok().json(users)
}
Licensed under either of Apache License, Version 2.0 or MIT license at your option.