// MIT/Apache2 License //! Hello world example. use async_io::Async; use axum::{response::Html, routing::get, Router}; use macro_rules_attribute::apply; use std::io; use std::net::TcpListener; use std::sync::Arc; #[apply(smol_macros::main!)] async fn main(ex: &Arc>) -> io::Result<()> { // Build our application with a route. let app = Router::new().route("/", get(handler)); // Create a `smol`-based TCP listener. let listener = Async::::bind(([127, 0, 0, 1], 3000)).unwrap(); println!("listening on {}", listener.get_ref().local_addr().unwrap()); // Run it using `smol_axum` smol_axum::serve(ex.clone(), listener, app).await } async fn handler() -> Html<&'static str> { Html("

Hello, World!

") }