This template removes the Railties and gems that don't make sense for an API-only application. It also adds the following gems:
- Rspec, Guard, Pry (byebug), SimpleCov, Mutant
- Puma
- roar-rails
The template will generate the Rspec files and initialize guard.
A Dockerfile
and docker-compose.yml
are included in the generated app.
rails new service_name -m https://raw.githubusercontent.com/Skookum/uu-rails-api-template/master/rails-api-template.rb
or
rails new service_name -m <path-to>/rails-api-template.rb
or
rails-api new service_name -m <path-to>/rails-api-template.rb
Once the app exists
cd service_name
And then you can:
guard
or
docker-compose up
docker-compose run api rake db:create # The first time
And you should be good to go. (Presuming you have boot2docker or docker installed)
The prmd
is included in the dev environment. It is used to help create JSON Schema for the API. This schema is then used to validate JSON sent to/from the API, as well as generate docs.
Add the .yml files for each API resource into schema/schemata, then call rake schema:combine
. To generate markdown, rake schema:doc
The template also adds the committee
gem along with middleware provided by that gem to validate JSON schema against the generated JSON schema file.
This template adds a /health
route that points to health#index
. This is the health check endpoint that should make sure dependent servics are responding, etc. It's also known as a canary endpoint. It should return JSON and be secured with an API token.
The mutant is included to enable mutation testing.
- Document mutation testing command/flow