0
0
Firebasecloud~30 mins

Function deployment in Firebase - Mini Project: Build & Apply

Choose your learning style9 modes available
Firebase Function Deployment
📖 Scenario: You are building a simple backend for a mobile app using Firebase Functions. You want to create a cloud function that responds with a greeting message when called.
🎯 Goal: Deploy a Firebase cloud function named helloWorld that returns the text 'Hello from Firebase!' when triggered.
📋 What You'll Learn
Create a Firebase function named helloWorld
The function should respond with the exact text 'Hello from Firebase!'
Export the function properly for deployment
Use the Firebase Functions SDK correctly
💡 Why This Matters
🌍 Real World
Firebase Functions let you run backend code in the cloud without managing servers. This is useful for mobile apps, websites, and APIs.
💼 Career
Knowing how to deploy cloud functions is essential for backend developers and cloud engineers working with serverless architectures.
Progress0 / 4 steps
1
Setup Firebase Functions import
Write the line to import Firebase Functions SDK as functions using require.
Firebase
Need a hint?

This line imports the Firebase Functions library so you can create cloud functions.

2
Create the helloWorld function
Create a constant named helloWorld and assign it a Firebase HTTPS function using functions.https.onRequest. The function should take request and response parameters and respond with 'Hello from Firebase!' using response.send.
Firebase
Need a hint?

Use functions.https.onRequest to create an HTTP function. The callback receives request and response objects.

3
Export the helloWorld function
Export the helloWorld function by adding exports.helloWorld = helloWorld; at the end of the file.
Firebase
Need a hint?

This line makes the function available for deployment and use in Firebase.

4
Deploy the function using Firebase CLI
Write the exact Firebase CLI command to deploy only the helloWorld function.
Firebase
Need a hint?

Use the Firebase CLI command firebase deploy --only functions:helloWorld to deploy just this function.