Generate QR codes with rust
Started off as a server-side app and now is a client side web-app using WASM!
inspired from this article by Kiran Johns and built with kennytm/qrcode-rs.
- Setup the environment for WASM compilation
rustup target add wasm32-unknown-unknown
rustup override set nightly
cargo install wasm-pack wasm-gc
- Generate the WASM and bindings
wasm-pack build --target web
wasm-gc pkg/qrs_bg.wasm
- Setup a web-server to host the following files & folders in particular:
- index.html - The html that loads the app.
- index.js - The JS that starts the show.
- pkg/ - The package folder that houses our wasm and bindings generated with
wasm-pack
.
- Open
http://localhost:8080
in a browser.