34 releases

0.5.0 Jun 13, 2024
0.5.0-beta.2 Apr 23, 2024
0.5.0-alpha.2 Mar 17, 2024
0.3.14 Oct 1, 2023
0.1.0 Mar 17, 2020

#637 in Web programming


Used in 2 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

~6–17MB
~223K SLoC