Skip to content

ranajahanzaib/firebase-rest-api-template

Repository files navigation

Firesbase REST APIs Template

GitHub license PRs Welcome

Use this template to quickly start creating, and deploying REST APIs on Google Firebase & Cloud Functions.

Getting Started

Follow the steps below to create and deploy new REST API on Firebase.

1 - Create New Firebase Project

Go to Firebase Console and create a new project, if you haven't already.

2: Add ProjectID

Add your project ID to the .firebaserc file.

File: .firebaserc

{
  "projects": {
    "default": "FIREBASE_PROJECT_ID"
  }
}

Replace FIREBASE_PROJECT_ID with your Firebase Project ID

3: Install Dependencies

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

4: Add Endpoints

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);
});

...

5: Deploy API Function to Firebase

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

Contributing

We'd love to accept your patches and contributions to this project. There are just a few guidelines you need to follow.

Code of Conduct

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.

Contributing Guide

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.

LICENSE

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.

About

Start Creating REST APIs on Google Firebase & Cloud Functions in 2 mins

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published