Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 1.48 KB

File metadata and controls

57 lines (39 loc) · 1.48 KB

QStash Workflow Cloudflare Workers Example

This is an example of how to use QStash Workflow with Cloudflare Workers. You can learn more in Workflow documentation for Cloudflare Workers.

Deploy to Cloudflare Workers

Development

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
  1. Install the dependencies
npm install
  1. Get the credentials from the Upstash Console and add them to the .dev.vars file.
QSTASH_URL=
QSTASH_TOKEN=
  1. 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.

  1. Run the development server
npm run dev
  1. Send a POST request to the endpoint.
curl -X POST "http:localhost:3001" -d '{"text": "hello world!"}'

Deployment

You can use wrangler to deploy the project to Cloudflare Workers.

npm run deploy