#http #web #actix #actix-web #diesel

nightly serwus

Helpers for building actix-web/diesel based services

3 releases

0.1.2 Jan 9, 2024
0.1.1 Dec 21, 2023
0.1.0 Sep 26, 2023

#306 in HTTP server

43 downloads per month

MIT/Apache and maybe GPL-3.0-or-later

88KB
2K SLoC

Serwus

Helpers for building actix-web/diesel based services.

crates.io Documentation MIT or Apache 2.0 licensed Dependency Status CI downloads

Features

  • MultiPool - Master/replica-aware wrapper for r2d2
  • StatsPresenter - Framework for readiness and statistics reporting
  • JsonError - Middleware that makes actix-web return errors as JSONs

Example

use actix_web::web;
use serwus::{
    server::{Serwus, default_cors},
    EmptyStats
};

#[derive(Clone, EmptyStats)]
pub struct AppData;

async fn hello() -> &'static str {
    "Hello world\n"
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    let prepare_app_data = || AppData;

    Serwus::default()
        .start(
            prepare_app_data,
            |app| {
                app.route("/", web::get().to(hello));
            },
            default_cors,
        )
        .await
}

Dependencies

~18–39MB
~686K SLoC