wasi
WCGI Template for Rust
(API Docs)
This is a template project for creating a WCGI-compatible package that can be published to the Wasmer Registry.
Getting Started
To run this demo, you will need to install the Wasmer toolchain.
curl https://get.wasmer.io -sSfL | sh
Next, make sure you have Rust and its wasm32-wasi target installed.
rustup target add wasm32-wasi
Now, you can compile the project to WebAssembly.
$ cargo build --target=wasm32-wasi --release
Finished release [optimized] target(s) in 0.00s
$ ls target/wasm32-wasi/release
build deps examples incremental wcgi-rust-template.d wcgi-rust-template.wasm
At this point, you would normally publish the package to the Wasmer Registry.
wasmer login
wasmer publish
Note: Please update the default namespace in the
wasmer.tomlfile before publishing.
You can also use wasmer run to test things locally.
$ wasmer run . --net
INFO run: wasmer_wasix::runners::wcgi::runner: Starting the server address=127.0.0.1:8000 command_name="server"
Note: The
--netflag is required to enable networking support in Wasmer.
Once you have it published you can also deploy it to Wasmer Edge
wasmer deploy
This will deploy the app to Wasmer Edge. The configuration of your app will reside in the app.yaml file.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
It is recommended to always use cargo crev to verify the
trustworthiness of each of your dependencies, including this one.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
The intent of this crate is to be free of soundness bugs. The developers will do their best to avoid them, and welcome help in analysing and fixing them.