1- # WASI Rust Sample
1+ # Sample: ` wasi:http ` in Rust
22
33[ ![ Open in GitHub Codespaces] ( https://github.com/codespaces/badge.svg )] ( https://codespaces.new/yoshuawuyts/rust-wasi-hello )
44
5- An example project showing how to build an HTTP server for WASI 0.2 built in
6- Rust.
5+ An example project showing how to build a spec-compliant
6+ [ ` wasi:http/proxy ` ] [ wasi-http ] server for WASI 0.2 written in Rust. This sample
7+ includes several [ routes] ( #routes ) that showcase different behavior. This sample
8+ can be run by any spec-compliant ` wasi:http/proxy ` server.
9+
10+ Each release of this sample is packaged up as a [ Wasm OCI image] [ wasm-oci-image ]
11+ and published to the [ GitHub Packages Registry] [ gh-pkg ] . See the [ "Deploying
12+ published artifacts"] [ using-arifacts ] section for more on how to fetch and run
13+ the published artifacts.
714
815## Routes
916
@@ -38,7 +45,7 @@ The HTTP server uses the `wasi:http/proxy` world. You can run it locally in a
3845$ cargo component serve
3946```
4047
41- ## Working with deployment artifacts
48+ ## Deploying published artifacts
4249
4350This project automatically published compiled Wasm Components as OCI to GitHub
4451Artifacts. You can pull the artifact with any OCI-compliant tooling and run it
@@ -47,8 +54,8 @@ latest published version from GitHub releases and run it in a local `wasmtime`
4754instance you can run the following command:
4855
4956``` bash
50- $ wkg pull ghcr.io/yoshuawuyts/ rust-wasi-hello :latest
51- $ wasmtime serve rust -wasi-hello .wasm
57+ $ wkg pull ghcr.io/bytecodealliance/sample-wasi-http- rust/sample -wasi-http-rust :latest
58+ $ wasmtime serve sample -wasi-http-rust .wasm
5259```
5360
5461For production workloads however, you may want to use other runtimes or
@@ -66,3 +73,7 @@ on the pull + serve pattern we've shown here.
6673Apache-2.0 with LLVM Exception
6774
6875[ cargo-component ] : https://github.com/bytecodealliance/cargo-component
76+ [ wasm-oci-image ] : https://tag-runtime.cncf.io/wgs/wasm/deliverables/wasm-oci-artifact/
77+ [ gh-pkg ] : https://github.com/bytecodealliance/sample-wasi-http-rust/pkgs/container/sample-wasi-http-rust%2Fsample-wasi-http-rust
78+ [ using-arifacts ] : #working-with-deployment-artifacts
79+ [ wasi-http ] : https://github.com/WebAssembly/wasi-http
0 commit comments