Is it possible to have a worker and a pages app on the same domain

I am making a website and want to host them on the same domain, ie the api on mydomain.com/api/* and the webapp on mydomain.com/*. I'm not sure if I can do this with two separate workers, but I imagine I could get something working by serving the webapp in the same worker as the backend. Not sure though, is there any good advice?
3 Replies
gdesmedt1
gdesmedt14d ago
I've been battling to get this up and running myself - but that grok answer has actually helped - and I've decided to go back to 2 seperate things - 1 PAGES and 1 WORKER - and keeping it seperate - and then figuring. out the routing so that it all runs of one URL
pat
patOP4d ago
Yeah I found that you can't set routing on pages and theres a very very low chance that you will find a way to do so Which lead me to either having a single worker that serves the frontend and the backend (not a bad option but I don't like the dev and deploy experience) or using page functions I can use page functions so thats what I went with. I imagine in anything more complex than what I've got youd want the first option.

Did you find this page helpful?