This repository consists of REST API codes using NodeJS to make a connection between mobile, Cloud Firestore, and Cloud Storage (bucket). We build the API's container with Cloud Build and deploy it with Cloud Run.
- Clone the respository:
git clone https://github.com/SoilIt/Backend-Application - Open the project with Visual Studio Code
- Run the application with
node index.jsornpx nodemon index.jscommand from command line interface
We use Firestore emulator to connect app from local to Firestore. Use two command line interface to run the app and the emulator!
- Install gcloud CLI: https://cloud.google.com/sdk/docs/install
- Update gcloud CLI installation to get the latest features:
gcloud components updateor the CLI will install the emulator automatically if you insert the emulator command - Run the following command to start the emulator:
gcloud emulators firestore startorgcloud emulators firestore start --host-port=HOST:PORTfor spesific host and port - Type CTRL + C to stop the emulator
Check this out for more information about the emulator: https://cloud.google.com/firestore/docs/emulator
- Use the
./deploy.shcommand to automatically build and deploy the API or - Insert the two command in deploy.sh file to manually build and deploy the API and change the project ID to your project ID in Google Cloud
Check this out for more references:
- Cloud Build command: https://cloud.google.com/sdk/gcloud/reference/builds/submit
- Cloud Run command: https://cloud.google.com/sdk/gcloud/reference/run
In case you want to know how we connect to Firestore, check out this video!