INNER CODE UNIT · Rust
router
cloudflare/workers-rs · templates/axum/src/lib.rs:5
fn router() -> Router {
Router::new().route("/", get(root))
}
#[event(fetch)]
async fn fetch(
req: HttpRequest,
_env: Env,
_ctx: Context,
) -> Result<axum::http::Response<axum::body::Body>> {
Ok(router().call(req).await?)
}
pub async fn root() -> &'static str {
"Hello Axum!"
}