I've built a dynamic site using typescript in cloud functions. I also have cloud functions triggers, which whenever data changes in Firestore, the relevant pages recompile themselves to a static page hosted in a firebase cloud storage bucket.
Bucket look something like this:
gs://[bucketname].appspot.com
/app/index.html
/app/page1.html
/app/page2.html
/uploads/images.webp
...
Currently, the static site is served through an express app within a cloud function named app. The problem here lies within the cloud function states. They aren't always hot, which makes the initial load time very slow.
firebase.json
"hosting": {
"public": "public",
"rewrites": [{ "source": "**", "function": "app" }],
}
What I would like to achieve, is to have Firebase hosting point to the files from the bucket instead of having an express app within a cloud function. Something between the lines of:
firebase.json
"hosting": {
"public": "public",
"rewrites": [
{ "source": "**/:url", "destination": "[BUCKETURL]/app/:url.html" },
{ "source": "**", "destination": "[BUCKETURL]/app/index.html" }]
}
My URL structure is very simple, it's domain.com/page-name and I also want to keep it that way without .html at the end. Any advice would be greatly appreciated. Thank you