Connecting Firebase cloud functions
We will be serving dynamic content using cloud functions, which also means the website that we hosted in the Firebase hosting service is not going to be static content anymore. Let's deep dive into hosting a dynamic web application.
Create a new project and initialize Hosting and functions through the Terminal as shown here:
firebase init hosting
The following screenshot shows a successful Hosting initialization:
Now, initialize Firebase functions with the following command:
$firebase init functions
After successful node initialization, let's install the express server framework in the functions directory:
$cd functions $npm i express --save
The following screenshot shows how to install additional node modules in the functions
directory:
Now, you can go to the root directory of the project and open the project in your favorite code editor. You will notice two directories: functions
and public
. Here, public
is the static web application directory, whereas functions...