https://github.com/peimelo/controlled_health_api
Controlled Health website API built with Ruby on Rails 6 as API and using devise_token_auth.
https://github.com/peimelo/controlled_health_api
api devise-token-auth rails ruby ruby-on-rails
Last synced: about 1 month ago
JSON representation
Controlled Health website API built with Ruby on Rails 6 as API and using devise_token_auth.
- Host: GitHub
- URL: https://github.com/peimelo/controlled_health_api
- Owner: peimelo
- Created: 2020-07-28T21:43:08.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-01-19T22:23:45.000Z (over 3 years ago)
- Last Synced: 2025-07-14T09:08:47.849Z (12 months ago)
- Topics: api, devise-token-auth, rails, ruby, ruby-on-rails
- Language: Ruby
- Homepage: https://saudecontrolada.com.br
- Size: 315 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Controlled Health API [](https://codeclimate.com/github/peimelo/controlled_health_api/maintainability)

Controlled Health website API built with [Ruby on Rails](https://rubyonrails.org/) as API and using [devise_token_auth](https://github.com/lynndylanhurley/devise_token_auth).
Ruby version
3.0.4
Rails version
6.1.6.1
Database
PostgreSQL
The frontend of this repository was built with Angular and is called [controlled-health-frontend](https://github.com/peimelo/controlled-health-frontend).
## Configuration
```bash
git clone https://github.com/peimelo/controlled_health_api.git
cd controlled_health_api
# installation of dependencies
bundle install
# creation of database and tables
rails db:create
rails db:migrate
# load initial data
rails db:seed
# run the project
rails s
```
## Configuration for Production
```bash
# delete the config/credentials.yml.enc file
rm config/credentials.yml.enc
# run the command to create credentials and master key (replace 'code' if you don't use VS Code)
EDITOR="code --wait" bin/rails credentials:edit
```
Add the information below in the [credentials](https://guides.rubyonrails.org/security.html#custom-credentials) to configure the email used by the Devise
gem and Exception Notification gem (replace with the values you want):
```yml
# ... your content above
gmail:
user_name: your@email.com
password: your_password
exception_recipients: exceptions@example.com
```
Save and close the `config/credentials.yml.enc` file.
If you want to use another email provider, change it in the file
`config/environments/production.rb`.
To configure `default_confirm_success_url`, change it in the file
`config/initializers/devise_token_auth.rb`.
To configure [CORS](https://github.com/cyu/rack-cors) `origins`, change it in the file
`config/initializers/cors.rb`.
To configure [Exception Notification](https://github.com/smartinez87/exception_notification), change it in the file
`config/initializers/exception_notification.rb`.
## Tests
To run the tests:
```bash
bundle exec rspec
```
## Configuration to use Docker
```bash
# upload the web and database instances
docker-compose up -d
# creation of tables
docker-compose exec web bundle exec rails db:migrate
# load initial data
docker-compose exec web bundle exec rails db:seed
# creation of database and test tables
docker-compose exec web bundle exec rails db:create RAILS_ENV=test
docker-compose exec web bundle exec rails db:migrate RAILS_ENV=test
# run the tests
docker-compose exec web bundle exec rspec
# stop the instances
docker-compose stop
```