This is an example of how to use QStash Workflow with Cloudflare Workers. You can learn more in Workflow documentation for Cloudflare Workers.
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
- Install the dependencies
npm install
- Get the credentials from the Upstash Console and add them to the
.dev.vars
file.
QSTASH_URL=
QSTASH_TOKEN=
- Open a local tunnel to port of the development server
ngrok http 3001
Also, set the UPSTASH_WORKLFOW_URL
environment variable to the public url provided by ngrok.
- Run the development server
npm run dev
- Send a
POST
request to the endpoint.
curl -X POST "http:localhost:3001" -d '{"text": "hello world!"}'
You can use wrangler to deploy the project to Cloudflare Workers.
npm run deploy