actix-web-requestid 0.1.2

Request ID middleware for actix-web
Documentation

Actix-web-requestid

Build Status codecov 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 = "0.1.1"

And this to your crate root:

extern crate actix_web;
extern crate actix_web_requestid;

use actix_web::{http, server, App, Path, Responder};
use actix_web_requestid::RequestIDHeader

fn index(info: Path<(u32, String)>) -> impl Responder {
    format!("Hello {}! id:{}", info.1, info.0)
}

fn main() {
    server::new(
        || App::new()
            .middleware(RequestIDHeader)
            .route("/{id}/{name}/index.html", http::Method::GET, index))
        .bind("127.0.0.1:8080").unwrap()
        .run();
}

License

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