Micro Http

the async micro http server

tbc...

Example

```rust use http::Method;

use microweb::filter::header; use microweb::router::{get, post}; use microweb::{handlerfn, Router, Server};

async fn simplehandler1(method: &Method, str: Option, str2: Option) -> String { println!("receive body: {}, {}", str.issome(), str2.issome()); format!("handler_1 : receive from method: {}\r\n", method) }

async fn simplehandler2(method: &Method) -> String { format!("handler_2: receive from method: {}\r\n", method) }

async fn simplehandler3(method: &Method, str: Option, str2: Option) -> String { println!("receive body: {}, {}", str.issome(), str2.issome()); format!("handler_3: receive from method: {}\r\n", method) }

async fn simplehandler4(method: &Method, str: Option, str2: Option) -> String { println!("receive body: {}, {}", str.issome(), str2.issome()); format!("handler_4: receive from method: {}\r\n", method) }

async fn default_handler() -> &'static str { "404 not found" }

[tokio::main]

async fn main() { let router = Router::builder() .route("/", get(handlerfn(simplehandler1))) .route( "/", post(handlerfn(simplehandler2)) .with(header(http::header::CONTENTTYPE, mime::APPLICATIONWWWFORMURLENCODED.asref())), ) .route("/", post(handlerfn(simplehandler3))) .route("/4", get(handlerfn(simplehandler_4))) .build();

Server::builder()
    .router(router)
    .address("127.0.0.1:8080")
    .default_handler(handler_fn(default_handler))
    .build()
    .unwrap()
    .start()
    .await;

} ```