Apolofx / detoxify-back

Backend for detoxify mobile app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node.js CI-CD dev .github/workflows/master.yml

Install

npm i or yarn

Local development

  1. Make sure to have a postgres DB instance running locally
  2. Run migrations πŸ‘‰ npx prisma migrate dev
  3. Run seeds on local DB πŸ‘‰ npx prisma db seed

DataBase

  1. For any changes made on prisma.schema, remember to run npx prisma migrate dev locally in order to generate new prisma client and update migrations SQL scripts.

ERD

ERD

Test

  • Run all tests once, with coverage results πŸ‘‰ npm run test
  • Run all tests while developing with --watch flag πŸ‘‰ npm run test:watch

Environments

  • DEV πŸ‘‰ http://dev.detoxify.ar/api
  • PROD πŸ‘‰ http://detoxify.ar/api

Endpoints

Health Check

GET /health


Users

All routes need Authorization header with a valid bearer token provided to the user making the request.

GET /users

GET /users/:id

GET /users/:id/details

GET /users/:id/achievements

GET /users/:id/snapshot

PUT /users/:id

POST /users

Auth

POST /auth/login

POST /auth/register


TODO:

  • Add TLS certificates
  • Configure chron job to calculate user stats

About

Backend for detoxify mobile app


Languages

Language:HTML 49.5%Language:TypeScript 47.1%Language:CSS 2.1%Language:Shell 0.7%Language:JavaScript 0.5%Language:Procfile 0.0%