An adapter to easily allow an Axum server to be run within a Cloudflare worker.
```rust use worker::*; use axum::{ response::{Html}, routing::get, Router as AxumRouter, extract::State, }; use axumcloudflareadapter::{toaxumrequest, toworkerresponse, workerroutecompat, EnvWrapper}; use tower_service::Service; use std::ops::Deref;
pub struct AxumState { pub env_wrapper: EnvWrapper, }
async fn index(State(state): State Hello from Axum!
pub async fn main(req: Request, env: Env, _ctx: worker::Context) -> Result
cd adapter && wasm-pack test --firefox --headless
cd adapter && cargo build --target wasm32-unknown-unknown
The /example
directory contains a Cloudflare worker running an Axum sever