This project is a 🚧 work in progress 🚧. Currently it is designed around the goals of rspc but feel free to reach to me if you want to collaborate on using it in your own project.
```rust // Define your a single HTTP handler which is supported by all major Rust webservers. async fn handler<'a>( ctx: (), _req: ConcreteRequest, _cookies: &'a mut CookieJar, ) -> EndpointResult { Ok(Response::builder() .status(StatusCode::OK) .header("Content-Type", "text/html") .body(b"Hello httpz World!".tovec())?) }
// Define a httpz generic endpoint. handler MUST be a function, closures will not work. let endpoint = GenericEndpoint::new((), [Method::GET, Method::POST], handler);
// Attach your generic endpoint to any HTTP webserver you like (Axum shown here). let app = axum::Router::new().route("/", endpoint.axum()); ```
Check out the rest of the examples!
httpz is primarily designed to make life easier for library authors. It allows a library author to write and test a HTTP endpoint once and know it will work for all major Rust HTTP servers.
Libraries using httpz:
If you are interested in using httpz and have questions jump in the Discord!