Setting up the Cloud Storage
With Firebase SDK, we can easily integrate and set up Cloud Storage for Firebase in our application.
To set up Cloud Storage, you will need the URL of the Storage bucket, which you can get from our Firebase Console. You can get it from the Files
tab of Storage
menu, as illustrated:
Once you get it, you can add it to your Firebase config.
Consider this example:
import firebase from 'firebase';
const config = {
apiKey: "AIzaSyDO1VEnd5VmWd2OWQ9NQkkkkh-ehNXcoPTy-w",
authDomain: "demoproject-7cc0d.firebaseapp.com",
databaseURL: "https://demoproject-7cc0d.firebaseio.com",
projectId: "demoproject-7cc0d",
storageBucket: "gs://demoproject-7cc0d.appspot.com",
messagingSenderId: "41428255555"
};
export const firebaseApp = firebase.initializeApp(config);
// Get a reference to the storage service,
var storage = firebase.storage();
Now we are ready to use Cloud storage. Now we need to create a reference, which can be used to navigate through the file hierarchy...