Meongku Web Service API is a web service that can accurately identify cat breeds, provide breed-specific information, and recommend food products. This service is designed to help pet owners understand their cats better and provide care that suits their pets' needs.
The first thing you need to know is that the service requires authentication to access each service. You need to register to use the service. You can register on the service register. You can register using your name, email, password, and phone number. After successfully registering, you can use the email and password you registered to log in. If you have any ideas to improve the security of this service, please contact us.
Base url of this service is: http://localhost:3000
-
Clone repository with the following command
git clone https://github.com/handokota/meongku-api.git
-
Move to the repository directory with the command
cd meongku-api/
-
Run the following command to install the depedency
npm install
-
Save
serviceAccountKey.json
in the root directory obtained from your Firebase project -
Edit file
.env
in the root directory and make sure the configuration values match your Firebase projectPORT=3000 API_KEY=YOUR_API_KEY AUTH_DOMAIN=YOUR_AUTH_DOMAIN PROJECT_ID=YOUR_PROJECT_ID STORAGE_BUCKET=YOUR_STORAGE_BUCKET MESSAGING_SENDER_ID=YOUR_MESSAGING_SENDER_ID APP_ID=YOUR_APP_ID MEASUREMENT_ID=YOUR_MEASUREMENT_ID NODE_ENV=localhost
-
Run app
npm run start-dev
- Cloud Environment: Google Cloud Platform (Cloud Run)
- Programming Language: Javascript
- Web Server: Node.js (Rest Api)
- Serverless: Cloud Run
-
Open cloud shell and set the project id
gcloud config set project PROJECT_ID
-
Clone repository following this command
git clone -b main https://github.com/handokota/meongku-api.git
-
Open the app folder
cd meongku-api/
-
Save
serviceAccountKey.json
in the root directory obtained from your Firebase project -
Edit file
.env
in the root directory and make sure the configuration values match your Firebase projectPORT=3000 API_KEY=YOUR_API_KEY AUTH_DOMAIN=YOUR_AUTH_DOMAIN PROJECT_ID=YOUR_PROJECT_ID STORAGE_BUCKET=YOUR_STORAGE_BUCKET MESSAGING_SENDER_ID=YOUR_MESSAGING_SENDER_ID APP_ID=YOUR_APP_ID MEASUREMENT_ID=YOUR_MEASUREMENT_ID NODE_ENV=localhost
-
Build docker image manual
docker buildx build --platform linux/amd64 -t api-meongku:v1 .
-
View the results of a successfully created docker image
docker image ls
-
Tag a Docker image with a specific label
docker tag {id} gcr.io/{PROJECT_ID}/api-meongku:v1
-
Push the docker image to the container registry
docker push gcr.io/{PROJECT_ID}/api-meongku:v1
-
Create a service in the Cloud Run, select the previously deployed docker image in the container registry, set port to 3000, adjust other configurations and deploy.
-
Authentications
Endpoint Method Description /register POST HTTP POST REQUEST post data to our Firestore /login POST HTTP POST REQUEST to login with email and password /logout POST HTTP POST REQUEST to logging out user POST /register
POST /login
POST /logout
-
Home
Endpoint Method Description / GET HTTP GET REQUEST /{any*} GET HTTP GET REQUEST to url not available GET /
GET /{any*}
-
Users
Endpoint Method Description /users/{uid} GET HTTP GET REQUEST /users/{uid} PUT HTTP PUT REQUEST to edit profile user /users/{uid}/edit-password PUT HTTP PUT REQUEST to edit user password GET /users/{uid}
PUT /users/{uid}
PUT /users/{uid}/edit-password
-
Articles
Endpoint Method Description /articles GET HTTP GET REQUEST /articles/{id} GET HTTP GET REQUEST to get article by id GET /articles
GET /articles/{id}
-
Cats
Endpoint Method Description /cats GET HTTP GET REQUEST /cats/{id} GET HTTP GET REQUEST to get cat by id GET /cats
GET /cats/{id}
-
Cat Food Recommendations
Endpoint Method Description /cat-food-recommendations POST HTTP POST REQUEST to get cat food product recommendation POST /cat-food-recommendations
This service uses a id token that is created as a session cookie to more easily create an expired token in Firebase for authentication. You must have an account to access this service. First, if you do not have an account, create a new account. Then, login to get a session id for authentication. You need to authenticate yourself with your email and password. If the authentication is valid, you can use this session id to access the protected service. Otherwise, you will get an error message and be expected to log in.
This Web service uses Postman to test.
You can download the Postman documentation here
We are using github action to setup, build and deploy the Cloud Run service in our project on Google Cloud Platform. New revision will created after push the changes on main branch of the development repository.