Template for durable objects, rollup, es modules
APACHE-2.0 License
A template for kick starting a Cloudflare Workers project using:
Worker code is in src/
. The Durable Object Counter
class is in src/counter.mjs
, and the eyeball script is in index.mjs
.
Rollup is configured to output a bundled ES Module to dist/index.mjs
.
Once you have published the worker, you can interact with it as follows:
bash-3.2$ curl worker.your-account-name.workers.dev/
Select a Durable Object to contact by using the `name` URL query string parameter. e.g. ?name=A
bash-3.2$ curl worker.your-account-name.workers.dev/?name=A
Durable Object 'A' 0 is even
bash-3.2$ curl worker.your-account-name.workers.dev/increment?name=A
Durable Object 'A' 1 is odd
bash-3.2$ curl worker.your-account-name.workers.dev/increment?name=A
Durable Object 'A' 2 is even
bash-3.2$ curl worker.your-account-name.workers.dev/decrement?name=A
Durable Object 'A' 1 is odd