Multiple Worker Architecture
I am seeking guidance on best practices and a sample repository that can help me understand how to properly set up a project with multiple workers responding to a single API gateway, like api.example.com. Specifically, I want to use different workers for different endpoints, directing /files to worker_1 and /jobs to worker_2. Additionally, I need to implement rate limiting and authentication for these services. How can I effectively organize and configure this project using Wrangler to include these features?
4 Replies
btw you can use 1 worker for difrrenet routes
just get path from request and handle separately
I what use multiple workers for separate functions
use honojs
- Create a npm workspace
- Create each worker
- Create a router worker with service binding to other workers
- Use Hono or itty-router
- In the same router worker you can do rate limiting or create a single worker just for that (that will go before router with bindings to it)