This is an example of how to use QStash Workflow with Cloudflare Workers with Hono router. You can learn more in Workflow documentation for Hono.
Tip
You can use the bootstrap.sh script to run this example with a local tunnel.
Simply set the environment variables as explained below and run the following command in the qstash-js/examples/workflow directory:
bash bootstrap.sh cloudflare-workers-hono
- Install the dependencies
npm install- Get the credentials from the Upstash Console and add them to the
.dev.varsfile.
QSTASH_URL=
QSTASH_TOKEN=- Open a local tunnel to port of the development server
ngrok http 3001Also, set the UPSTASH_WORKLFOW_URL environment variable to the public url provided by ngrok.
- Run the development server
npm run dev- Send a
POSTrequest to the/workflowendpoint.
curl -X POST "http:localhost:3001/workflow" -d '{"text": "hello world!"}'You can use wrangler to deploy the project to Cloudflare Workers.
npm run deploy