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
mnik01
mnik0111mo ago
btw you can use 1 worker for difrrenet routes just get path from request and handle separately
bllmo
bllmo11mo ago
I what use multiple workers for separate functions
w3bcode
w3bcode11mo ago
use honojs
Radoš
Radoš11mo ago
- 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)
Want results from more Discord servers?
Add your server