Multi Workers For API - Use one worker as main router or use Cloudflare routes?

are , I am building an API with over 15 workers. What is the best way to route? Reading the docs I can see there are two approaches: 1: Map custom domain to one Worker that invokes the others based on the URL 2: Use the Routes feature in the Cloudflare One seems to be the better option but I am unsure. Help and advice needed.
2 Replies
Tin Cap
Tin Cap8mo ago
Option #1 will work, but double your invocations Is there a reason it's 15 separate workers? Can it just be one? If you're going to have multiple workers, can you just map them to different routes? "domain.com/api/one/*"
AlexanderKaran
AlexanderKaran8mo ago
It is a large API and they will not all fit in one. For example some of the stuff happening in the carbon emission section is pretty heavy I did try the Routes option but it did not seem to work, is there a guide for setting up workers on different sub routes? Got it working with routes, will get rid of the first worker lol Thanks