Skip to content

Request ID injector and middleware for actix-web

Notifications You must be signed in to change notification settings

kirinse/actix-web-requestid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.0.0-beta.1"

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).

About

Request ID injector and middleware for actix-web

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%