use micro_web::date::DateServiceDecorator;
use micro_web::router::{get, Router};
use micro_web::Server;
async fn hello_world() -> &'static str {
"hello world"
}
async fn default_handler() -> &'static str {
"404 not found"
}
#[tokio::main]
async fn main() {
let router = Router::builder()
.route("/", get(hello_world))
.with_global_decorator(DateServiceDecorator)
.build();
Server::builder()
.router(router)
.bind("127.0.0.1:3000")
.default_handler(default_handler)
.build()
.unwrap()
.start()
.await;
}