Cloudflare Enablement
Durable Objects
Edit this page on GitHub
Set theme to dark (⇧+D)

Build a counter

Build a counter using Durable Objects and Workers with RPC methods.

This example shows how to build a counter using Durable Objects and Workers with RPC methods that can print, increment, and decrement a name provided by the URL query string parameter, for example, ?name=A.

Finally, configure your wrangler.toml file to include a Durable Object binding and migration based on the namespace and class name chosen previously.