RasainApp-backend is a part of RasainApp project for Bangkit 2022 Capstone Project.
RasainApp-backend is a web application built using Node.js technology to provide a RESTful API service for the RasainApp project. This web application will be deployed in a cloud environment using a serverless container service--Google Cloud Platform's Cloud Run.
Repository | Description |
---|---|
RasainApp | Android application. |
RasainApp-backend | Backend service. |
RasainApp-ml | Machine learning. |
- Node.js v16
- Yarn v3.2.1
- Cloud Firestore
- GCP Service Account
The service account's roles must include Firebase Admin SDK Administrator Service Agent
.
Resources you may need:
- https://nodejs.org/en/
- https://yarnpkg.com/getting-started/install
- https://cloud.google.com/firestore
- https://cloud.google.com/iam/docs/service-accounts
Allow read
and write
actions in the Cloud Firestore Security Rules.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
-
Clone this repository, run
git clone https://github.com/andikabahari/RasainApp-backend.git .
-
Create your own
.env
by copying the content of.env.example
APP_PORT=8080
SALT_ROUNDS=10
TOKEN_SECRET=my_token_secret
GCP_PROJECT_ID=my_gcp_project_id
GCP_SERVICE_ACCOUNT_KEY="./service_account.json"
TENSORFLOW_SAVED_MODEL="./bin/SavedModel/model.json"
- Copy your service account key inside
service_account.json
, the content will likely look like this
{
"type": "service_account",
"project_id": your_project_id",
"private_key_id": "your_private_key_id",
"private_key": "your_private_key",
"client_email": "your_client_email",
"client_id": "your_client_id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "your_client_cert_url"
}
- Install dependencies, run
yarn install
.
- For production, run
yarn start
- For development, run
yarn dev
.
- To perform test once, run
yarn test
- To perform test with watch mode, run
yarn test:watch
.
To install production-only dependencies, run yarn workspaces focus --production
.
Parameters:
email
string (body) *requiredpassword
string (body) *required.
Parameters:
fullName
string (body) *requiredemail
string (body) *requiredpassword
string (body) *required.
Parameters:
id
string (path) *required.
Headers:
Authorization: Bearer your_token
.
Parameters:
id
string (path) *requiredfullName
string (body)email
string (body)password
string (body).
Headers:
Authorization: Bearer your_token
.
Parameters:
image
file (multipart/form-data) *required.