# routerify **Repository Path**: mirrors_influxdata/routerify ## Basic Information - **Project Name**: routerify - **Description**: A lightweight, idiomatic, composable and modular router implementation with middleware support for the Rust HTTP library hyper.rs - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-01-30 - **Last Updated**: 2025-11-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
[](https://github.com/routerify/routerify/actions) [](https://crates.io/crates/routerify) [](https://docs.rs/routerify) [](https://github.com/orgs/routerify/people) [](./LICENSE) # Looking for a maintainer. Please ping me at hello@rousan.io, if anyone is interested to actively maintain this project. # Routerify The `Routerify` provides a lightweight, idiomatic, composable and modular router implementation with middleware support for the Rust HTTP library [hyper.rs](https://hyper.rs/). There are a lot of web server frameworks for Rust applications out there and [hyper.rs](https://hyper.rs/) being comparably very fast and ready for production use is one of them, and it provides only low level API. It doesn't provide any complex routing feature. So, `Routerify` extends the [hyper.rs](https://hyper.rs/) library by providing that missing feature without compromising any performance. The `Routerify` offers the following features: - 📡 Allows defining complex routing logic. - 🔨 Provides middleware support. - 🌀 Supports Route Parameters. - 🚀 Fast as it's using [`RegexSet`](https://docs.rs/regex/1.3.7/regex/struct.RegexSet.html) to match routes. - 🍺 It supports any response body type as long as it implements the [HttpBody](https://docs.rs/hyper/0.13.5/hyper/body/trait.HttpBody.html) trait. - ❗ Provides a flexible error handling strategy. - 💁 Provides `WebSocket` [support](https://github.com/routerify/routerify-websocket) out of the box. - 🔥 Allows data/state sharing across the route and middleware handlers. - 🍗 Exhaustive [examples](https://github.com/routerify/routerify/tree/master/examples) and well documented. To generate a quick server app using [Routerify](https://github.com/routerify/routerify) and [hyper.rs](https://hyper.rs/), please check out [hyper-routerify-server-template](https://github.com/routerify/hyper-routerify-server-template). ## Benchmarks | Framework | Language | Requests/sec | |----------------|-------------|--------------| | [hyper v0.13](https://github.com/hyperium/hyper) | Rust 1.43.0 | 112,557 | | [routerify v1.1](https://github.com/routerify/routerify) with [hyper v0.13](https://github.com/hyperium/hyper) | Rust 1.43.0 | 112,320 | | [gotham v0.4.0](https://github.com/gotham-rs/gotham) | Rust 1.43.0 | 100,097 | | [actix-web v2](https://github.com/actix/actix-web) | Rust 1.43.0 | 96,397 | | [warp v0.2](https://github.com/seanmonstar/warp) | Rust 1.43.0 | 81,912 | | [go-httprouter, branch master](https://github.com/julienschmidt/httprouter) | Go 1.13.7 | 74,958 | | [Rocket, branch async](https://github.com/SergioBenitez/Rocket) | Rust 1.43.0 | 2,041 ? | For more info, please visit [Benchmarks](https://github.com/routerify/routerify-benchmark). ## Install Add this to your `Cargo.toml` file: ```toml [dependencies] routerify = "1.1" ``` ## Basic Example A simple example using `Routerify` with [hyper.rs](https://hyper.rs/) would look like the following: ```rust use hyper::{Body, Request, Response, Server, StatusCode}; // Import the routerify prelude traits. use routerify::prelude::*; use routerify::{Middleware, Router, RouterService, RequestInfo}; use std::{convert::Infallible, net::SocketAddr}; // Define an app state to share it across the route handlers and middlewares. struct State(u64); // A handler for "/" page. async fn home_handler(req: Request) -> Result