| Crates.io | prax-axum |
| lib.rs | prax-axum |
| version | 0.5.0 |
| created_at | 2025-12-21 17:54:31.018048+00 |
| updated_at | 2026-01-07 18:35:16.553403+00 |
| description | Axum framework integration for Prax ORM |
| homepage | https://github.com/pegasusheavy/prax-orm |
| repository | https://github.com/pegasusheavy/prax-orm |
| max_upload_size | |
| id | 1998392 |
| size | 95,998 |
Axum framework integration for Prax ORM.
prax-axum provides Tower-compatible middleware and extractors for the Axum web framework.
PraxLayer Tower middlewareDatabaseConnection extractoruse axum::{Router, routing::get};
use prax_axum::{PraxClientBuilder, PraxLayer, DatabaseConnection};
#[tokio::main]
async fn main() {
let prax = PraxClientBuilder::new()
.url("postgresql://localhost/mydb")
.build()
.await
.unwrap();
let app = Router::new()
.route("/users", get(list_users))
.layer(PraxLayer::new(prax));
axum::serve(listener, app).await.unwrap();
}
async fn list_users(
DatabaseConnection(db): DatabaseConnection,
) -> Json<Vec<User>> {
let users = db.user().find_many().exec().await.unwrap();
Json(users)
}
Licensed under either of Apache License, Version 2.0 or MIT license at your option.