This repository is for the Backend side of the ATongs Application. The results will be an Endpoint URL that will be used when classifying waste in the ATongs App which will be consumed by the Mobile Development Team as an ML Model classification API.
Check ATongs API's Postman Documentation here
Also check API Testing Example
Follow this steps
Clone the repository
git clone https://github.com/ATongs/ATongs-Backend.git
- Install dependencies
cd ATongs-Backend
npm install
- Go to
src/services/config.js
or config.js and change this 2 line
Un-comment the Local Environment and commented out the Deployed Environment, then replace the REDACTED
with the value of actual API_KEY
, like this
// const API_KEY = process.env.GOOGLE_API_KEY; // Deployed Environment
const API_KEY = 'REDACTED'; // Local environment
- Run
npm run start:dev
- Build Docker Image
docker build -t <image name> .
Example:
docker build -t atongs-backend .
- Inspect the image that already builded
docker images | grep "<image-name>"
Example:
$ docker images | grep "atongs-backend"
atongs-backend latest 80b285313e1c 13 minutes ago 2.07GB
- Run the container in Detached Mode
docker run -d -p 9000:9000 --name <container-name> <image-name>
Example:
docker run -d -p 9000:9000 --name atongs-backend atongs-backend
- Check the container if it's already running
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f8c8aebf2098 atongs-backend "docker-entrypoint.s…" 15 minutes ago Up 15 minutes 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp atongs-backend
- Run docker compose up, this will build in detach mode
docker compose up -d --build
- Check the container if it's already running
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7d6fc6bced3a node:20 "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp atongs-backend-app-1
- Stop the container
docker compose down