Firebase Admin Integration

Now that we've successfully installed Firebase CLI, let's copy the existing application code from Chapter 3, Authentication with Firebase, to the new directory in Chapter 5, User Profile and Access Management. Here, we'll initialize the Firebase app and run the following command to log in to the Firebase console before initializing the app:

firebase login

Once you are successfully logged in to the Firebase console, run the following command to initialize the project:

firebase init

Once we run this command, it will prompt you to select the Firebase feature, project, and directory folder (relative to your project directory) that will contain hosting assets to be uploaded with the firebase deploy command (by default, it is public).

We can also add features later on in our project, and it's also possible to associate multiple projects with the same directory.

Once Firebase initialization is complete, run the following command to install the project dependencies and then build the project:

//run this command to install the project dependencies
npm install

//run this command to build the project
npm run build

To run our application locally to verify before deploying to the production, run the following command:

firebase serve

It will start the server locally from build directory or whatever the name you have defined in the firebase.json file:

This is what our folder structure looks like after firebase initialization using the firebase CLI.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset