Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples
args: --workspace --all --bins --examples

- name: wstd tests
uses: actions-rs/cargo@v1
Expand All @@ -42,7 +42,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: -p test-programs-artifacts -- --nocapture
args: -p test-programs -- --nocapture


check_fmt_and_docs:
Expand Down
19 changes: 12 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,22 @@ serde_json.workspace = true

[workspace]
members = [
"axum",
"axum/macro",
"macro",
"test-programs",
"test-programs/artifacts",
]
resolver = "2"

[workspace.package]
version = "0.5.6"
edition = "2021"
edition = "2024"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wstd"
keywords = ["WebAssembly", "async", "stdlib", "Components"]
categories = ["wasm", "asynchronous"]
# Rust-version policy: stable N-2, same as wasmtime.
rust-version = "1.87"
rust-version = "1.89"
authors = [
"Yoshua Wuyts <[email protected]>",
"Pat Hickey <[email protected]>",
Expand All @@ -71,6 +72,7 @@ authors = [
anyhow = "1"
async-task = "4.7"
async-trait = "*"
axum = { version = "0.8.6", default-features = false }
bytes = "1.10.1"
cargo_metadata = "0.22"
clap = { version = "4.5.26", features = ["derive"] }
Expand All @@ -87,15 +89,18 @@ pin-project-lite = "0.2.8"
quote = "1.0"
serde= "1"
serde_json = "1"
serde_qs = "0.15"
slab = "0.4.9"
syn = "2.0"
test-log = { version = "0.2", features = ["trace"] }
test-programs = { path = "test-programs" }
test-programs-artifacts = { path = "test-programs/artifacts" }
ureq = { version = "2.12.1", default-features = false }
tower-service = "0.3.3"
ureq = { version = "3.1", default-features = false, features = ["json"] }
wasip2 = "1.0"
wstd = { path = "." }
wstd-macro = { path = "macro", version = "=0.5.6" }
wstd = { path = ".", version = "=0.5.6" }
wstd-axum = { path = "./axum", version = "=0.5.6" }
wstd-axum-macro = { path = "./axum/macro", version = "=0.5.6" }
wstd-macro = { path = "./macro", version = "=0.5.6" }

[package.metadata.docs.rs]
all-features = true
Expand Down
24 changes: 24 additions & 0 deletions axum/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "wstd-axum"
description = "Support for axum as a wasi http server via wstd"
version.workspace = true
license.workspace = true
edition.workspace = true
authors.workspace = true
keywords.workspace = true
categories.workspace = true
repository.workspace = true
rust-version.workspace = true

[dependencies]
axum.workspace = true
tower-service.workspace = true
wstd.workspace = true
wstd-axum-macro.workspace = true

[dev-dependencies]
anyhow.workspace = true
futures-concurrency.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_qs.workspace = true
axum = { workspace = true, features = ["query", "json", "macros"] }
18 changes: 18 additions & 0 deletions axum/examples/hello_world.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! Run with
//!
//! ```sh
//! cargo build -p wstd-axum --examples --target wasm32-wasip2
//! wasmtime serve -Scli target/wasm32-wasip2/debug/examples/hello-world.wasm
//! ```

use axum::{Router, response::Html, routing::get};

#[wstd_axum::http_server]
fn main() -> Router {
// build our application with a route
Router::new().route("/", get(handler))
}

async fn handler() -> Html<&'static str> {
Html("<h1>Hello, World!</h1>")
}
19 changes: 19 additions & 0 deletions axum/examples/hello_world_nomacro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//! Run with
//!
//! ```sh
//! cargo build -p wstd-axum --examples --target wasm32-wasip2
//! wasmtime serve -Scli target/wasm32-wasip2/debug/examples/hello-world-nomacro.wasm
//! ```

use axum::{Router, response::Html, routing::get};
use wstd::http::{Body, Error, Request, Response};

#[wstd::http_server]
async fn main(request: Request<Body>) -> Result<Response<Body>, Error> {
let service = Router::new().route("/", get(handler));
wstd_axum::serve(request, service).await
}

async fn handler() -> Html<&'static str> {
Html("<h1>Hello, World!</h1>")
}
Loading
Loading