Skip to content

Latest commit

 

History

History

backend

CareHelper Backend API

Description

The backend code of product CareHelper in GDSC - DUT

For backend team

Installation

# install dependencies
$ npm install

Database initialization

$ docker compose up -d init_db
  • Note: Remember to add --build option when running the init_db the first time

Migration

# Reset database
$ npm run db:reset

# Create new migration file
$ npm run knex migrate:make <migration_name_file.js>

# Run the migration
$ npm run knex migrate:latest

# Rollback the migration
$ npm run knex migrate:rollback

Seeding

# Create seed file
$ npm run knex seed:make <seed_name_file.js>

# Run all seed file
$ npm run knex seed:run

# Run specific seed file
$ npm run knex seed:run --specific=<seed-filename.js>

For more information you can read at Knexjs docs

https://knexjs.org/guide/migrations.html#migration-cli

Run the backend code

# Dev mode
$ npm run dev

# Production mode
$ npm start

Access localhost:3000/docs to view the Swagger Docs

Husky

Run the following command when you first clone the repo

$ cd backend

$ npm run prepare

Commit convention

View the commitlint.config.js file to follow commit convention

For Frontend and Mobile team

Run the api

$ docker compose up -d api
  • Note: Remember to add --build option when running the init_db the first time