This repository contains RESTful API for users and pets management. The API integrates with Google Cloud using Cloud SQL for the database to store the users and pets data. Beside that, we also have configured it to the Google Cloud Storage to store pets image. This server has been deployed using App Engine.
https://backend-dot-capstone-opet.et.r.appspot.com
Project is created with:
- Node.js (v16.17.0)
- NPM (8.15.0)
- Google Cloud SQL (MySQL 8.0)
- Register :
POST/register - Login :
POST/login
- Get Logged User
GET/users/me - Update User Data
PUT/users/edit
- Get All Pets with Pagination
GET/pets?type={{type}}&page={{page}}&size={{size}} - Get Pet Detail
GET/pets/{{id}} - Upload Pet Data
POST/mypets - Get Only Owner's Pets
GET/mypets - Update Owner's Pet
PUT/mypets/{{id}} - Delete Owner's Pet
DELETE/mypets/{{id}}
- Create a project.
- Link a billing account.
- In the navigation menu, select SQL.
- Choose MySQL as the Database Engine.
- Select MySQL 8.0 as the Database Version.
- Set up and create the MySQL instance.
- In the navigation menu, select Cloud Storage.
- Create and set up the bucket.
- Uncheck "Enforce public access prevention on this bucket".
- Choose "Fine-grained" as the Access control.
- Click "Create".
- Create a Service Account and assign the role of "Storage Object Creator".
- Create a new key for the Service Account and select JSON as the key type.
- Save the Service Account key file to Secret Manager.
- Activate Cloud Shell and clone this repository.
- Run
npm install. - Run
gcloud app deploy. Type "Y" and press Enter to proceed with the deployment.
- Connect this repository.
- Create a trigger for when there is a push to a branch.
- Add environment variables to connect to the SQL Instance.
