fire-http

Crates.iofire-http
lib.rsfire-http
version0.5.0
sourcesrc
created_at2020-03-17 00:15:00.819791
updated_at2024-06-13 21:34:01.134601
descriptionHttp async library based on hyper and tokio
homepage
repositoryhttps://github.com/fire-lib/fire-http
max_upload_size
id219661
size153,866
Sören Meier (soerenmeier)

documentation

README

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
Commit count: 111

cargo fmt