init rust stuff
This commit is contained in:
20
src/lib.rs
Normal file
20
src/lib.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use axum::{routing::get, Router};
|
||||
use tower_service::Service;
|
||||
use worker::*;
|
||||
|
||||
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!"
|
||||
}
|
||||
Reference in New Issue
Block a user