- Run
docker-compose build
- Run
docker-compose up -d backend db
On another window run (make sure that both containers are up and running):
- Run
docker-compose run backend rake db:setup
Run docker-compose run test
. (You only need to have db container up.)
I've also setup Travis CI for this repository. You can check its badge on top of this page โ . First time using docker on travis.yml ๐๐.
For API documentation, I've used Apipie which is a DSL and Rails engine for documenting RESTful APIs. You can see all the details here. First time using it and it was awesome! ๐๐ฝ
If you run the API is just a matter of access the following endpoint: localhost:3000/apipie. There you will see the documentation for all the requested endpoints (POST, PUT/PATCH and GET). For each one you have details about:
- Request method, path and description;
- Request parameters (require or optional, type and description);
- All possible errors that can be returned as a response (each with a proper description);
- Request response body with all the details about parameters and types.
In case of you don't run the API please check the following GIF ๐.
We have 5 tables: cars, models, makers, colors and model_colors (join table between models and colors). There's the schema for each table:
- Cars
- Models
- Makers
- Colors
- Model Colors
You can also see the db schema here. I've used seeds.rb to populate all tables except cars table in order to have all resources prepared.
In addition, I've created db indexes for monthly, year and available_from columns (cars table), and name column (makers table). These indexes will make our reads much faster with API growth.