HTTP SERVER 
Speedy HTTP server built purely in Rust. Comes with built-in GZIP compression and HTTPS support. Uses procedural macros for easy API building.
Example 1:
use TcpListener;
use *;
Speedy HTTP server built purely in Rust. Comes with built-in GZIP compression and HTTPS support. Uses procedural macros for easy API building.
Example 1:
use std::net::TcpListener;
use tinyhttp::config::*;
fn main() {
let socket = TcpListener::bind(":::9001").unwrap();
let routes = Routes::new(vec![get()]);
let config = Config::new().routes(routes);
let http = HttpListener::new(socket, config);
http.start();
}
#[get("/")]
fn get() -> &'static str {
"Hello, World!"
}
#[post("/")]
fn post(body: Vec<u8>) -> Vec<u8> {
"Hi, there!".into()
}