actix-web-requestid

Crates.ioactix-web-requestid
lib.rsactix-web-requestid
version2.1.0
sourcesrc
created_at2018-08-24 11:24:44.116607
updated_at2023-03-03 18:00:39.981075
descriptionRequest ID middleware for actix-web
homepagehttps://github.com/pastjean/actix-web-requestid
repositoryhttps://github.com/pastjean/actix-web-requestid
max_upload_size
id81049
size10,822
Pierre-Alexandre St-Jean (pastjean)

documentation

https://docs.rs/actix-web-requestid

README

Actix-web-requestid

CI crates.io Documentation License

A rust library to add a requestid with the actix-web framework.

Usage

Add this to your Cargo.toml:

[dependencies]
actix-web-requestid = "2.1.0"

And this to your crate root:

use actix_web::{web, App, HttpServer, HttpResponse, Error};
use actix_web_requestid::{RequestID, RequestIDMiddlware};

#[actix_rt::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(
        || App::new()
            .wrap(RequestIDMiddleware::new())
            .service(web::resource("/").to(|| HttpResponse::Ok())))
        .bind("127.0.0.1:59880")?
        .run()
        .await
}

License

actix-web-requestid is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

Commit count: 44

cargo fmt