| Crates.io | prax-armature |
| lib.rs | prax-armature |
| version | 0.5.0 |
| created_at | 2025-12-21 17:54:25.157632+00 |
| updated_at | 2026-01-07 18:35:06.867299+00 |
| description | Armature framework integration for Prax ORM |
| homepage | https://github.com/pegasusheavy/prax-orm |
| repository | https://github.com/pegasusheavy/prax-orm |
| max_upload_size | |
| id | 1998391 |
| size | 92,143 |
Armature framework integration for Prax ORM.
prax-armature provides seamless integration with the Armature HTTP framework using dependency injection.
use armature::prelude::*;
use prax_armature::{PraxClient, PraxClientBuilder};
#[module_impl]
impl DatabaseModule {
#[provider(singleton)]
async fn prax_client() -> Arc<PraxClient> {
let client = PraxClientBuilder::new()
.url("postgresql://localhost/mydb")
.build()
.await
.unwrap();
Arc::new(client)
}
}
#[controller("/users")]
impl UserController {
#[get("/")]
async fn list_users(
&self,
#[inject] db: Arc<PraxClient>,
) -> Result<Json<Vec<User>>, HttpError> {
let users = db.user().find_many().exec().await?;
Ok(Json(users))
}
}
Licensed under either of Apache License, Version 2.0 or MIT license at your option.