If I want my pages app (Vite + React)
If I want my pages app (Vite + React) deployed to
domain.com/route
but then I also have pages functions eg functions/connect-to-db.js
what route will that server function be accessible at?8 Replies
I'm assuming it will be on domain.com/connect-to-db
It depends on how you are deploying the Vite app to a path.
If the path is done in Vite internally (i.e. the Pages project is just deployed on the whole domain and then Vite is set to only use /route) then yes, the path will be
domain.com/connect-to-db
can you clarify?
so how do I call my pages function in the frontend part of the vite app? Just do a fetch request to that domain.com/connect-to-db URL?
the Pages project is NOT being deployed to the whole domain
at least, I don't want to
How are you restricting it to the path?
I was planning to just set the trigger to a specific route
can I not do that?
I don't think you can with Pages, no.
oh
but I guess I can redirect using a worker to a page?
so I could redirect
inventxyz.com/team
to team.inventxyz.com
?functions are deployed from the root of the project and their routing is folder based so
you can only setup the functions starting from the domain/subdomain defined for the cloudflare page. You can indeed add a worker for that redirection
as long as you own the domain