简体   繁体   中英

is it possible to host Firebase web app which use Firestore with Firebase Hosting?

I am developing an android app using Firebase. I also want to create a web version of it. should I host it in Firebase Hosting or do I need a separate web server for it? I want to use Firestore as a database for this web version.

You can very well host it with Firebase Hosting in the same Firebase project you have for your Firestore instance.

You could also, if necessary, create another Firebase project just for the hosting.

And, finally, you could host the web app at any other internet provider.

Actually, what is indicating to your app which Firestore instance to use is not where it is hosted but the Firebase config elements you use for configuring Firebase in your web app, eg:

var config = {
  apiKey: 'zzzzzzzzzz',
  authDomain: 'xxxxxx.firebaseapp.com',
  databaseURL: 'https://yyyyyy.firebaseio.com',
  projectId: '.......'
};

firebase.initializeApp(config);

Note that Firebase Hosting is particularly adapted to the hosting of "single-page web apps, marketing websites, and static assets" and it offers many advantages, as detailed in the doc

Firebase Hosting is a fully-managed hosting service for static and dynamic content as well as microservices. The service is backed by SSD storage and a global CDN (content delivery network). Zero-configuration SSL is built into Firebase Hosting, so content is always delivered securely.

Benefit from Firebase Hosting's unique optimization for serving single-page web apps and static websites. Delivery of static assets (HTML, CSS, JavaScript, fonts, etc.) is powered by our SSD backend storage and a global CDN with edge locations across all major locations in the world. You can even cache your dynamic content on the global CDN. All sites hosted by Firebase also get a free SSL certificate, so your content is always delivered securely .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM