Diffinery

homeflare/celldpublic

celld/examples/wasm/README.md
27 lines · 858 BRaw History
1# wasm
2
3A Durable Object counter in Rust, compiled to Wasm with
4[workers-rs](https://github.com/cloudflare/workers-rs).
5
6`worker-build` is the workers-rs build tool. It compiles the crate to
7`wasm32-unknown-unknown`, runs wasm-bindgen over the output, and writes the
8JavaScript entry point (`build/worker/shim.mjs`) that `wrangler.jsonc` names as
9`main` — you do not write any JavaScript yourself. Install it once, build, and
10deploy:
11
12```sh
13rustup target add wasm32-unknown-unknown
14cargo install worker-build
15
16worker-build --release
17celld deploy . --bucket s3://my-cells-bucket
18```
19
20```sh
21curl http://localhost:8080/c/hello
22curl http://localhost:8080/c/hello
23curl http://localhost:8080/c/other
24```
25
26See [the WebAssembly docs](../../docs/wasm.md) for how celld ships and runs the
27`.wasm` module. Contributed by [Connor Hindley](https://github.com/connyay).