warp README

The project's README from github.com/seanmonstar/warp. As one markdown file: README.md.

warp

crates.io Released API docs MIT licensed GHA Build Status Discord chat

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

The fundamental building block of warp is the Filter: they can be combined and composed to express rich requirements on requests.

Thanks to its Filter system, warp provides these out of the box:

Since it builds on top of hyper, you automatically get:

Example

Add warp and Tokio to your dependencies:

tokio = { version = "1", features = ["full"] }
warp = { version = "0.4", features = ["server"] }

And then get started in your main.rs:

use warp::Filter;

#[tokio::main]
async fn main() {
    // GET /hello/warp => 200 OK with body "Hello, warp!"
    let hello = warp::path!("hello" / String)
        .map(|name| format!("Hello, {}!", name));

    warp::serve(hello)
        .run(([127, 0, 0, 1], 3030))
        .await;
}

For more information you can check the docs or the examples.

warp (seanmonstar/warp)

Searching Database…

10.4K ·GitHub
这是什么?warp 是一个非常易用、可组合的 Rust Web 服务器框架,号称能带来'warp 速度'(曲速)。
用 warp 搭建服务器到底是怎么回事?一切皆 Filter(过滤器):你把这些积木式的组件组合起来,就能对请求表达各种丰富的要求,比如路径、请求头、查询字符串和请求体。
我怎么才能先把第一个服务器跑起来?在你的 Cargo 依赖里加上 warp 和 Tokio,在 main.rs 里写好服务器,然后查阅文档或自带的示例。
warp 是免费的吗?商用项目里也能用吗?是的。它采用 MIT 许可证,个人和商业使用都免费。
学习曲线陡不陡?README 靠着可组合的 Filter 把它宣传得超级简单,但它运行在 Tokio 异步运行时上,所以懂一点异步 Rust 会更有帮助。
What are similar projects?actix-web, axum, Rocket, pingora, aiohttp, echo, starlette, fiber
Size
0.9 MB
Stars
10.4K
Age
8y
Commits · 90 Days