Firebase Hosting provides production-grade, fast and secure (HTTPS - HTTP over TLS) static hosting for your web app.It can be used to deploy web applications (JavaScript based applications) or to deploy a static content to a global content delivery network (CDN) with a single command. In this tutorial, In this tutorial static website is hosted using Firebase Hosting feature.
Key capabilities
Hosting provides auto-generated subdomain on the firebaseapp.com domain and developer can verify custom domain to redirect the website. Firebase automatically provisions an SSL certification to the custom domain so all the content are served securely. Using the Firebase CLI, the developer can deploy files from current directory to the hosting server. Files are served over an SSL connection, due to this reason if website or web app use unsecured (HTTP) connection to retrieve files like fonts, it will be blocked. Developers have freedom to rewrite URLs for client-side routing or set up custom headers.
Currently, Firebase does not provide a way to execute code on Firebase servers. PHP or any other server-side language do NOT work in the Firebase infrastructure.
Implementation path
To install the Firebase CLI, you needs to install Node.js. Once you install the Node.js you can install the Firebase CLI using npm (Node Package Manager) by running the following command. You don't have to go to the project directory to install Firebase CLI ( It is installed globally using -g).
npm install -g firebase-tools
It will take couple minutes to install Firebase CLI depending on your Internet bandwidth. Once the installation is done, use the following command to log into the firebase. It connects the local machine to the Firebase account and grants access to all your projects. To test whether you can access all of your projects type firebase list command.
firebase login
Set up a project directory
For many tasks such as deployment, Firebase CLI requires project directory. It contains firebase.json configuration file. It should generally be the same as project root. To initialize a new project directory, go to your project root and type the following command.
firebase init
Deploy the web app
To deploy the web app, type the following command.
firebase deploy
Go to the Hosting page in the Firebase Console and it will display all the deployments.
Key capabilities
- Files are served over a secure connection.
- Content is uploaded to SSDs at CDN edges around the world and cached to provide fast delivery.
- Firebase CLI provides facilities for rapid deployment.
- Developers can easily rollback to a previous deployment.
Hosting provides auto-generated subdomain on the firebaseapp.com domain and developer can verify custom domain to redirect the website. Firebase automatically provisions an SSL certification to the custom domain so all the content are served securely. Using the Firebase CLI, the developer can deploy files from current directory to the hosting server. Files are served over an SSL connection, due to this reason if website or web app use unsecured (HTTP) connection to retrieve files like fonts, it will be blocked. Developers have freedom to rewrite URLs for client-side routing or set up custom headers.
Currently, Firebase does not provide a way to execute code on Firebase servers. PHP or any other server-side language do NOT work in the Firebase infrastructure.
Implementation path
- Install the Firebase CLI.
- Set up a project directory.
- Deploy the web app.
To install the Firebase CLI, you needs to install Node.js. Once you install the Node.js you can install the Firebase CLI using npm (Node Package Manager) by running the following command. You don't have to go to the project directory to install Firebase CLI ( It is installed globally using -g).
npm install -g firebase-tools
It will take couple minutes to install Firebase CLI depending on your Internet bandwidth. Once the installation is done, use the following command to log into the firebase. It connects the local machine to the Firebase account and grants access to all your projects. To test whether you can access all of your projects type firebase list command.
firebase login
Set up a project directory
For many tasks such as deployment, Firebase CLI requires project directory. It contains firebase.json configuration file. It should generally be the same as project root. To initialize a new project directory, go to your project root and type the following command.
firebase init
Deploy the web app
To deploy the web app, type the following command.
firebase deploy
Go to the Hosting page in the Firebase Console and it will display all the deployments.
Comments
Post a Comment