Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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 above

gmail:
user_name: [email protected]
password: your_password

exception_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
```