# routerify **Repository Path**: mirrors_kornelski/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-07-11 - **Last Updated**: 2026-02-15 ## 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) # Routerify `Routerify` provides a lightweight, idiomatic, composable and modular router implementation with middleware support for the Rust HTTP library [hyper](https://hyper.rs/). Routerify's core features: - 🌀 Design complex routing using [scopes](https://github.com/routerify/routerify/blob/master/examples/scoped_router.rs) and [middlewares](https://github.com/routerify/routerify/blob/master/examples/middleware.rs) - 🚀 Fast route matching using [`RegexSet`](https://docs.rs/regex/1.4.3/regex/struct.RegexSet.html) - 🍺 Route handlers may return any [HttpBody](https://docs.rs/hyper/0.14.4/hyper/body/trait.HttpBody.html) - ❗ Flexible [error handling](https://github.com/routerify/routerify/blob/master/examples/error_handling_with_request_info.rs) strategy - 💁 [`WebSocket` support](https://github.com/routerify/routerify-websocket) out of the box. - 🔥 Route handlers and middleware [may share state](https://github.com/routerify/routerify/blob/master/examples/share_data_and_state.rs) - 🍗 [Extensive documentation](https://docs.rs/routerify/) and [examples](https://github.com/routerify/routerify/tree/master/examples) To generate a quick server app using [Routerify](https://github.com/routerify/routerify) and [hyper](https://hyper.rs/), please check out [hyper-routerify-server-template](https://github.com/routerify/hyper-routerify-server-template). *Compiler support: requires rustc 1.48+* ## Benchmarks | Framework | Language | Requests/sec | |----------------|-------------|--------------| | [hyper v0.14](https://github.com/hyperium/hyper) | Rust 1.50.0 | 144,583 | | [routerify v2.0.0](https://github.com/routerify/routerify) with [hyper v0.14](https://github.com/hyperium/hyper) | Rust 1.50.0 | 144,621 | | [actix-web v3](https://github.com/actix/actix-web) | Rust 1.50.0 | 131,292 | | [warp v0.3](https://github.com/seanmonstar/warp) | Rust 1.50.0 | 145,362 | | [go-httprouter, branch master](https://github.com/julienschmidt/httprouter) | Go 1.16 | 130,662 | | [Rocket, branch master](https://github.com/SergioBenitez/Rocket) | Rust 1.50.0 | 130,045 | For more info, please visit [Benchmarks](https://github.com/routerify/routerify-benchmark). ## Install Add this to your `Cargo.toml` file: ```toml [dependencies] routerify = "2" hyper = "0.14" tokio = { version = "1", features = ["full"] } ``` ## Basic Example A simple example using `Routerify` with `hyper` 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