martin1
1
I have been using cloud-flare workers
I have added a route and a script - Which works.
But now i want to add another route with another script.
How do I do that?
I can add another route.
But how do I create another script.
Am i suppose to write all my route scripts in the one script file?
If so how I detect the route in the file?
Seems confusing or am I missing somethings simple?
I am doing all of this from the Dashboard.
sdayman
2
Only Enterprise plans can have multiple scripts.
You’d have to do some clever scripting to apply different functions for different routes.
Or set up a second domain with the script you want and call it from the first domain. I know this has been done, but don’t recall the process.
1 Like
martin1
3
Yeah so just detect the URL and in the addEvent listener route it to the corresponding handler.
2 Likes
martin1
4
So can i point multiple routes at the one script
for example
…some url/pages/*
…some url/components/*
sdayman
5
You really don’t have a choice, but it’s what I do. My main domain and one subdomain point to the same script.