Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pastjean/actix-web-requestid
Request ID injector and middleware for actix-web
https://github.com/pastjean/actix-web-requestid
Last synced: 2 months ago
JSON representation
Request ID injector and middleware for actix-web
- Host: GitHub
- URL: https://github.com/pastjean/actix-web-requestid
- Owner: pastjean
- Created: 2018-08-24T10:56:43.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-03-27T01:19:44.000Z (10 months ago)
- Last Synced: 2024-10-05T15:17:45.321Z (3 months ago)
- Language: Rust
- Size: 32.2 KB
- Stars: 9
- Watchers: 0
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Actix-web-requestid
[![CI](https://github.com/pastjean/actix-web-requestid/workflows/CI/badge.svg)](https://github.com/pastjean/actix-web-requestid/actions?query=workflow%3ACI)
[![crates.io](https://meritbadge.herokuapp.com/actix-web-requestid)](https://crates.io/crates/actix-web-requestid)
[![Documentation](https://docs.rs/actix-web-requestid/badge.svg)](https://docs.rs/actix-web-requestid)
[![License](https://img.shields.io/crates/l/actix-web-requestid.svg)](https://github.com/pastjean/actix-web-requestid#license)A rust library to add a requestid with the actix-web framework.
# Usage
Add this to your Cargo.toml:
```toml
[dependencies]
actix-web-requestid = "2.1.0"
```And this to your crate root:
```rust
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).