This is a repository for the backend of DonDra project.
- Docker installed and running
- Internet connection
- Node.js installed and running
- Open a terminal from this project directory
- Run
docker compose build
- Run
docker-compose up
- Open http://localhost:3001/ in your browser
- Backend is up and running
- Run
npx ts-node typeorm/seed.ts
- ExpressJS (4.18.1)
- TypeORM (0.3.7)
- Docker
- Jest (v28.1.3)
- Node JS (v16.13.1)
- PostgreSQL (v12.2.0)
- Redis (using Upstash)
- Factory
Factory digunakan untuk melakukan inisiasi database (seeding). Factory ini akan membuat objek yang diubah menjadi data yang akan diinsert ke database. - Singleton
Singleton digunakan pada objek jwt. Objek jwt hanya ada satu instance yang bertugas memverifikasi token dan membuat token. - Observer
Design pattern observer digunakan dalam pembuatan route/endpoint. Observer dalam konteks ini adalah objek app yang kemudian dapat ditambahkan endpoint/router yang sudah dibuat.
All of the endpoints require token authentication except for login and register.
/checkUser/:id
- Check if user with id:id
exists/getAllUsers
- Get all users/getAllUsers/:id
- Get one user with the id:id
getHistory/:id?page=:page
- Get all history of user with id:id
with pagination from query./getSaldo/:id
- Get the balance of user with id:id
/getUnverifiedMoneytoring
- Get all unverified moneytoring from all user/getUnverifiedUsers
- Get all unverified users/login
- Login with username and password and return a token/register
- Register a new user/requestMoneytoring
- Send a add or substract balance request. Require body withid
,nominal
, andisIncome
/transfer
- Transfer money from one user to another. Require body withidPengirim
,idPenerima
, andnominal
/verifyMoneytoring/:idMoneytoring
- Verify moneytoring with id:idMoneytoring
, admin can reject or approve the request. Require body withisRejected
/verifyUser/:id
- Verify user with id:id
- Call
/login
to get a token - Call
/register
to register a new user - Use all the APIs by providing token
- The token is valid for 24 hours
- If you want to use your own
REDIS_URL
orDATABASE_URL
orPORT
variables, you can create.env
file in the root directory and add it - This backend is deployed under dondra-backend.herokuapp.com