Skip to content

yeukfei02/divisionly-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


divisionly-api

split expenses with friends

documentation: https://documenter.getpostman.com/view/3827865/UVBzoVbG

Requirement

  • install ruby (v2.7.4)
  • install gem
  • install bundle
  • install yarn
  • install node (v14+)

Testing and run

// install ruby dependencies
$ bundle install

// install node dependencies
$ yarn

// run api in local
$ rails s

// run rails console
$ rails c

// create controller
$ rails g controller <controllerName>

// create model
$ rails g model <modelName>

// create migration file
$ rails g migration <migrationName>

// db migration
$ rails db:migrate

// db rollback
$ rails db:rollback

// db reset
$ rails db:migrate:reset

// run db seed
$ rails db:seed

// create worker file
$ rails g sidekiq:worker <workerName>

// create mailer file
$ rails g mailer <mailerName>

// list routes
$ rails routes

// run test case
$ bundle exec rspec

// start sidekiq
$ bundle exec sidekiq

// rubocop
$ rubocop --auto-correct
$ rubocop -A

// reek
$ reek

// generate schema info in model
$ annotate --models

// audit Gemfile.lock
$ bundler-audit

Docker

// build images and start container in one line
docker-compose up -d --build

// run db migration in container
docker-compose exec web bundle exec rails db:migrate

// go inside container
docker exec -it <containerId> /bin/bash

// check container logs
docker logs <containerId>

// remove and stop container
docker-compose down

open localhost:3000