3 releases

new 0.1.2 Dec 19, 2024
0.1.1 Dec 19, 2024
0.1.0 Dec 18, 2024

#561 in HTTP server

31 downloads per month

MIT license

15KB
324 lines

potato

A very simple and high performance http library.

Usage

Run command:

cargo new hello_potato --bin
cd hello_potato
cargo add potato
cargo add tokio --features full

Paste code:

use potato::{http_get, server::HttpServer, HttpResponse, RequestContext};

async fn prefix_handler(_ctx: &mut RequestContext) -> Option<HttpResponse> {
    match _ctx.
    Some(HttpResponse::html("hello world"))
}

#[http_get("/hello")]
async fn hello(_ctx: RequestContext) -> HttpResponse {
    HttpResponse::html("hello world")
}

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

TODO

  • middleware
  • complete url parse
  • compress
  • cookie
  • chunked
  • CORS

Dependencies

~5–11MB
~114K SLoC