Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 20 hours 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 (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-19T22:23:45.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T07:50:20.593Z (7 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: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Controlled Health API [![Maintainability](https://api.codeclimate.com/v1/badges/b518207f640d3edfe849/maintainability)](https://codeclimate.com/github/peimelo/controlled_health_api/maintainability) ![Tests](https://github.com/peimelo/controlled_health_api/actions/workflows/ruby.yml/badge.svg)
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 abovegmail:
user_name: [email protected]
password: your_passwordexception_recipients: [email protected]
```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
```