This repository contains a serverless API built with Firebase Functions. The API is designed to handle various HTTP requests and provides endpoints for PlayBeach app.
-
Clone the repository:
git clone https://github.com/lucasguellis/PlayBeach-functions.git cd PlayBeach-functions -
Install dependencies:
npm install -g firebase-tools npm install
-
Set up Firebase CLI:
Log in to Firebase:
firebase login
Initialize Firebase in your project folder:
firebase init functions
Follow the prompts to set up the functions directory.
To run the API locally, use the following command:
npm run devThis will start the functions emulator, and you can access the API at http://localhost:5001/playbeach-deda5/us-central1/app.
See here the available endpoints of this API.
Create a .env file in the functions directory with the following variables:
// .env
GOOGLE_APPLICATION_CREDENTIALS=./playbeach-credentials.json// ./functions/.env
SECRET_KEY=SECRET_KEYCreate the json file with your actual Firebase project settings.
To deploy the functions to Firebase, run:
firebase deployThis command will deploy the functions to your Firebase project.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name. - Commit your changes:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature/your-feature-name. - Open a pull request to master.
This project is licensed under the MIT License - see the LICENSE file for details.