Local development
To test your Dispatch Worker, user Worker and Outbound Worker before deploying to production, you can use Wrangler for development and testing.
1. Create a user worker
When following the interactive prompts, answer the questions as below:
- Select
no
to using TypeScript. - Select
no
to deploying your application.
Update the src/index.js
file for customer-worker-1:
Update the wrangler.toml
file for customer-worker-1 and add the dispatch namespace:
2. Create a dispatch worker
When following the interactive prompts, answer the questions as below:
- Select
no
to using TypeScript. - Select
no
to deploying your application.
Update the src/index.js
file for dispatch-worker:
Update the wrangler.toml
file for dispatch-worker and add the dispatch namespace binding:
3. Create an Outbound Worker
When following the interactive prompts, answer the questions as below:
- Select
no
to using TypeScript. - Select
no
to deploying your application.
Update the src/index.js
file for outbound-worker:
4. Start local dev session for your Workers
In separate terminals, start a local dev session for each of your Workers.
For your dispatcher Worker:
For your outbound Worker:
And for your user Worker:
5. Test your requests
Send a request to your dispatcher Worker: