#fire #async-http #websocket #hyper #server #request #json

fire-http

Http async library based on hyper and tokio

32 releases

new 0.5.0-beta.2 Apr 23, 2024
0.5.0-alpha.2 Mar 17, 2024
0.3.14 Oct 1, 2023
0.3.12 Jul 19, 2023
0.1.0 Mar 17, 2020

#1 in #fire

Download history 14/week @ 2024-01-01 1/week @ 2024-01-08 8/week @ 2024-01-15 20/week @ 2024-01-29 23/week @ 2024-02-05 15/week @ 2024-02-12 121/week @ 2024-02-19 164/week @ 2024-02-26 261/week @ 2024-03-04 179/week @ 2024-03-11 131/week @ 2024-03-18 73/week @ 2024-04-01 8/week @ 2024-04-08 148/week @ 2024-04-15

233 downloads per month
Used in 3 crates

MIT/Apache

150KB
4.5K SLoC

A simple http server library.

Example

# use fire_http as fire;
use fire::{get, Res};

struct GlobalName(String);

// handle a simple get request
#[get("/")]
fn root(global_name: Res<GlobalName>) -> String {
	format!("Hi, this is {}", global_name.0)
}

#[tokio::main]
async fn main() {
	let mut server = fire::build("0.0.0.0:3000").await
		.expect("Failed to parse address");

	server.add_data(GlobalName("fire".into()));
	server.add_route(root);

	server.ignite().await.unwrap();
}

For more examples look in the examples directory and the test directory.

Features

  • json
  • fs
  • http2 (enables http 2 support)
  • ws (adds websocket support)
  • trace

Dependencies

~7–18MB
~235K SLoC