You will need to have wrangler installed to run this example.
Wrangler is a cli tool for interacting with Cloudflare services:
Build the client wasm and js bindings with wasm-pack to produce the 'pkg' directory containing the necessary js and wasm files for running the app.
cd client
wasm-pack build --target=web
The 'wrangler dev' command runs setup script from wrangler.toml and then launches a dev env.
- This script should work but due to a bug in worker-build (?) an alternative is used, see below *
[build]
command = "cargo install -q worker-build --version 0.0.7 && worker-build --release"
- Temporary build command *
[build]
command = "cargo install --git https://github.com/CathalMullan/workers-rs worker-build && worker-build --release"
Move into the cloudflare directory and run 'wrangler dev' to launch the worker locally:
cd cloudflare
wrangler dev
If this fails with [mf:err] Unhandled Promise Rejection: Error: To use the new ReadableStream() constructor, enable the streams_enable_constructors feature flag.
then run this instead:
cd cloudflare
wrangler dev --compatibility-flag streams_enable_constructors