Runs a Cloudflare Worker that proxies requests to the Alchemy API. The worker is written in Rust, compiled to WebAssembly, and deployed to Cloudflare's edge infrastructure.
The worker is configured using the following environment variables:
ALCHEMY_API_KEY
: The API key to use when making requests to The Graph API.
- Create a
.dev.vars
file in the root of the project. - Add the following content to the file:
ALCHEMY_API_KEY=<API_KEY>
npm i
npm run dev
Set the environment variable using:
npx wrangler secret put ALCHEMY_API_KEY
npm run deploy
Wrangler is used to develop, deploy, and configure your Worker via CLI.
Further documentation for Wrangler can be found here.
workers-rs
(the Rust SDK for Cloudflare Workers) is meant to be executed as compiled WebAssembly, and as such so must all the code you write and depend upon. All crates and modules used in Rust-based Workers projects have to compile to the wasm32-unknown-unknown
triple.
Read more about this on the workers-rs
project README.