Initial
This commit is contained in:
commit
31b6af97ba
5 changed files with 1168 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
target
|
||||
node_modules
|
||||
.wrangler
|
||||
1120
Cargo.lock
generated
Normal file
1120
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
18
Cargo.toml
Normal file
18
Cargo.toml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
name = "warden-worker"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = ["deepubuntu"]
|
||||
|
||||
[package.metadata.release]
|
||||
release = false
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
worker = { version = "0.6", features = ['http', 'axum'] }
|
||||
worker-macros = { version = "0.6", features = ['http'] }
|
||||
axum = { version = "0.8", default-features = false }
|
||||
tower-service = "0.3.3"
|
||||
console_error_panic_hook = "0.1.7"
|
||||
21
src/lib.rs
Normal file
21
src/lib.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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>> {
|
||||
console_error_panic_hook::set_once();
|
||||
Ok(router().call(req).await?)
|
||||
}
|
||||
|
||||
pub async fn root() -> &'static str {
|
||||
"Hello Axum!"
|
||||
}
|
||||
6
wrangler.toml
Normal file
6
wrangler.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
name = "warden-worker"
|
||||
main = "build/index.js"
|
||||
compatibility_date = "2025-09-19"
|
||||
|
||||
[build]
|
||||
command = "cargo install -q worker-build && worker-build --release"
|
||||
Loading…
Reference in a new issue