Use this template to quickly start creating, and deploying REST APIs on Google Firebase & Cloud Functions.
Follow the steps below to create and deploy new REST API on Firebase.
Go to Firebase Console and create a new project, if you haven't already.
Add your project ID to the .firebaserc
file.
File: .firebaserc
{
"projects": {
"default": "FIREBASE_PROJECT_ID"
}
}
Replace FIREBASE_PROJECT_ID
with your Firebase Project ID
Install the required dependecies described in api/package.json
using the commands below.
cd api/
npm install -g firebase-tools # Install Firebase CLI, required once
firebase login # Login to Firebase CLI, required once
npm install
Add your API Endpoints & Logic to api/index.js
// Start adding your endpoints
app.get("/YOUR_ENDPOINT_URL", (request, response) => {
const data = {
message: "Hello World!"
};
response.send(data);
});
...
To deploy your API to Firebase, run the following commands inside the api/
directory.
npm run deploy
OR, use the following command from any directory within the project repo.
firebase deploy --only functions
We'd love to accept your patches and contributions to this project. There are just a few guidelines you need to follow.
This project follows Contributor Covenant as it's Code of Conduct, and we expect all project participants to adhere to it. Please read the full guide so that you can understand what actions will not be tolerated.
Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to project.
This project is licensed under the MIT License, meaning that you're free to modify, distribute, and / or use it for any commercial or private project.