gitmyhub

warp

Rust ★ 10k updated 4d ago

A super-easy, composable, web server framework for warp speeds.

Warp is a Rust library for building web servers using composable filter building blocks, you combine small rules for routing, parsing, and request handling instead of configuring one large framework.

RusthyperTokioWebSocketgzipbrotlisetup: moderatecomplexity 3/5

Warp is a Rust library for building web servers. In web development, a "framework" provides the building blocks so you do not have to write the low-level details of handling internet requests from scratch. Warp focuses on being composable, meaning you build your server out of small, reusable pieces that you combine together rather than configuring a large monolithic system.

The central idea in warp is a concept called a Filter. A filter is a rule that a request must satisfy or a piece of data that should be extracted from the request. Filters for path matching, reading headers, parsing query strings, accepting JSON, handling file uploads, and other common tasks are included out of the box. You combine multiple filters together to describe exactly what a particular route should accept and what information it needs to process a request.

Built on top of a lower-level library called hyper, warp supports HTTP/1, HTTP/2, and WebSockets. Requests are handled asynchronously, meaning the server can handle many connections at once without waiting for each one to finish before starting the next. Compression formats like gzip and brotli are also available as built-in filters.

The README includes a short code example showing a server that responds to requests at a particular URL path. Adding warp to a Rust project involves two lines in the project configuration file, and a minimal working server is around ten lines of code. The documentation site and a collection of examples in the repository cover more advanced usage.

This is a library for Rust developers. It is not a standalone program and requires writing Rust code to use.

Where it fits