Code for the examples from the WebAssembly talk given at the Webmontag Meetup in Kassel.
- Rust Installation (https://www.rust-lang.org/learn/get-started)
- Node.js installation (https://nodejs.org)
- Simple HTTP server installation (e.g. https://www.npmjs.com/package/http-server)
- WASM runtime installation (e.g. https://github.com/wasm3/wasm3)
- Clone this repo.
- Open a Terminal at the position where you've cloned the repo.
- If not already done, install the Rust compiler's WASM target:
rustup target add wasm32-unknown-unknown
- Go to the
js-api
folder - Run
cargo build
- Run
http-server
- In a browser open http://localhost:8080
- Output should be similar to this:
- Go to the
wasm-pack
folder - If not already done, run
cargo install wasm-pack
- Run
wasm-pack build --target web
- Run
http-server
- In a browser open http://localhost:8080
- Output should be similar to this:
- Go to the
wasm-pack
folder - If not already done, run
cargo install wasm-pack
- Run
wasm-pack build --target nodejs
- Run
node index.js
- Output should be similar to this:
- Go to the
js-api
folder - Run
cargo build
- Run
wasm3 --func factorial target/wasm32-unknown-unknown/debug/js_api.wasm 10
- Output should be similar to this: