| Crates.io | actix-chain |
| lib.rs | actix-chain |
| version | 0.1.0 |
| created_at | 2025-07-23 02:21:21.762889+00 |
| updated_at | 2025-07-23 02:21:21.762889+00 |
| description | Actix-Web service chaining service. |
| homepage | |
| repository | https://github.com/imgurbot12/actix-services/tree/master/actix-chain |
| max_upload_size | |
| id | 1764295 |
| size | 63,860 |
actix-chainActix-Web service chaining service.
Provides a simple non-blocking service for chaining together other arbitrary services.
use actix_web::{App, HttpRequest, HttpResponse, Responder, web};
use actix_chain::{Chain, Link};
async fn might_fail(req: HttpRequest) -> impl Responder {
if !req.headers().contains_key("Required-Header") {
return HttpResponse::NotFound().body("Request Failed");
}
HttpResponse::Ok().body("It worked!")
}
async fn default() -> &'static str {
"First link failed!"
}
App::new().service(
Chain::default()
.link(Link::new(web::get().to(might_fail)))
.link(Link::new(web::get().to(default)))
);