How to Upload and Download from/to Firebase Storage in Node.js? (Part 2)

Easy configuration to connecting your Node.js app with Firebase Storage

Pandhu Wibowo
Dev Genius

--

Hi everyone, this is part 2 of article about Firebase Storage. If you are not reading part 1 yet, I suggest you to read part 1 first before going to part 2.

Let’s continue part 2 of this and make sure your mouse to always scroll down.

Click this menu.

Then, click the Get started button.

After clicking it, the next step is to choose mode, what is mode you made it. Cause this is just simple trial, in this tutorial I chose test mode. Then click Next.

The next step you shoud select the Location of Cloud Storage. My choice is asia-southeast2 . Consider the nearest region from where you are. The location where your user live and your server will determine the latency to your users. The closer it is, the faster it will access it, and vice versa.

Click Done.

Bucket will be creating it. And voilaaa your bucket has done.

We created the bucket. Now let’s we create the node project in your local. I will not share you about how to create the first node project. I just share you about where is the important thing we should go.

Alright, the next step is clone the credential project and put on into your local project. Give name it as you like.

Where is the credential?

Go to the Project settings. And then scroll down to Your apps section. Select web icon.

Fulfill this column with your app name. Click button Register app.

In your local, please install firebase package and copy the credential into it.

// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyAwMToLpiINwLvevaRkmuZQ72eWnkKuWos",
authDomain: "beneteen-dev.firebaseapp.com",
projectId: "beneteen-dev",
storageBucket: "beneteen-dev.appspot.com",
messagingSenderId: "537452487968",
appId: "1:537452487968:web:6c663618e2311404cd2345"
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);

Click Continue to console.

Read More My Articles

--

--