Reputation: 11
I'm trying to make a web application, where I wish to use Firebase storage for storing files such as images and mp3s, but I'm having some issues.
First setting up firebase. I've heard about two ways.
Gcloud:
let gcloud = require('gcloud')({ ... });
let storage = gcloud.storage({
projectId: '<projectID>',
keyFilename: 'service-account-credentials.json'
});
let bucket = storage.bucket('<projectID>.appspot.com');
Trouble is that I can't find the right npm install line for installing gcloud.
and firebase by config
const firebaseConfig = {
apiKey: ,
authDomain: ,
projectId: ,
storageBucket: ,
messagingSenderId: ,
appId:
};
firebase.initializeApp(firebaseConfig);
This could easily install with npm, but I wonder if it is the right way?
Then this is set up, how do I upload and read with fetching through javascript? I'm finding it kind of difficult, so could be nice with some directions.
Upvotes: 0
Views: 99
Reputation: 83163
Since you are developing a web application you should use the Firebase JavaScript SDK (and you should not use gcloud).
The guide to use this SDK in your web application is here.
Then you need to follow the documentation for Cloud Storage, again by using the JS SDK.
Upvotes: 1