#web #potato #http #server

potato

A very simple and high performance http library

42 releases

new 0.2.0 Apr 17, 2025
0.1.40 Apr 12, 2025
0.1.35 Mar 30, 2025
0.1.23 Jan 23, 2025
0.1.7 Dec 30, 2024

#300 in HTTP server

Download history 520/week @ 2024-12-25 1079/week @ 2025-01-01 376/week @ 2025-01-08 562/week @ 2025-01-15 253/week @ 2025-01-22 11/week @ 2025-01-29 18/week @ 2025-02-05 3/week @ 2025-02-19 46/week @ 2025-03-12 384/week @ 2025-03-19 1070/week @ 2025-03-26 388/week @ 2025-04-02 395/week @ 2025-04-09

2,283 downloads per month

MIT license

4MB
2.5K SLoC

potato

version status

高性能、简洁语法的HTTP框架。

用法

在线文档

加入库的引用:

cargo add potato
cargo add tokio --features full

Hello Server

use potato::*;

// http://127.0.0.1:8080/hello
#[http_get("/hello")]
async fn hello() -> HttpResponse {
    HttpResponse::html("hello world")
}

#[tokio::main]
async fn main() {
    let mut server = HttpServer::new("0.0.0.0:8080");
    _ = server.serve_http().await;
}

Hello Client

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let res = potato::get("https://www.fawdlstty.com", vec![]).await?;
    println!("{}", String::from_utf8(res.body)?);
    Ok(())
}

更多示例

请参考:https://github.com/fawdlstty/potato/tree/main/examples

Dependencies

~19–30MB
~516K SLoC