prax-actix

Crates.ioprax-actix
lib.rsprax-actix
version0.5.0
created_at2025-12-21 17:54:39.864081+00
updated_at2026-01-07 18:35:28.865588+00
descriptionActix-web framework integration for Prax ORM
homepagehttps://github.com/pegasusheavy/prax-orm
repositoryhttps://github.com/pegasusheavy/prax-orm
max_upload_size
id1998393
size101,277
Joseph R. Quinn (quinnjr)

documentation

README

prax-actix

Actix-web framework integration for Prax ORM.

Overview

prax-actix provides middleware and extractors for the Actix-web framework.

Features

  • PraxMiddleware for request handling
  • DatabaseConnection FromRequest extractor
  • App data integration
  • High-performance async design

Usage

use 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)
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Commit count: 0

cargo fmt