Some Confusion About Firebase Regarding Static Vs Dynamic Pages
So according to docs I've read, a webpage written in html code which includes script src="some_JavaScript_file.js is always a dynamic page even though the embedded JavaScript only has const sum=3+5 because no matter how simple it is, as long as there's even a tiny amount of backend involved, that webpage is definitely a dynamic webpage. so with that premise(please confirm that the premise I wrote is actually correct), my question is how does it make sense that Firebase claims it runs index.html sitting in Public folder ONLY when it's running a static webpage even though if that index.html file includes script src="some_JavaScript_file.js, it's a dynamic webpage?
Answer
Firebase Hosting doesn't interpret the content you host on it in any way. So if there's JavaScript in any of your files, Firebase doesn't execute that JavaScript code on its servers. Same for any other code: Firebase will serve the code as text (or whatever other format you stored it in) to clients that request it.
If your pages contain JavaScript that you want to run in the client's browser, that is precisely what you want. So you can serve a web site that contains client-side JavaScript on Firebase Hosting.
If you have any code that you want to run server-side you will have to look beyond Firebase Hosting. Nowadays you can stay within Google's infrastructure by integrating Firebase Hosting with Cloud Functions or Cloud Run.
Related Questions
- → How can I query Firebase for an equalTo boolean parameter?
- → How can I access nested data in Firebase with React?
- → Firebase simple blog (confused with security rules)
- → Removing item in Firebase with React, re-render returns item undefined
- → AngularJS Unknown Provider Error (Firebase & AngularFire)
- → How do you pass top level component state down to Routes using react-router?
- → "this" is null in firebase query function in reactjs
- → Angular Module Failed to Load
- → Multiple dex files define Lcom/google/android/gms/internal/zzrx;
- → Joining Firebase tables in React
- → How can I make add firepad to my reactjs project?
- → How to use Cloud Functions for Firebase to prerender pages for SEO?
- → React.js component has null state?