Api Dogs is an example project of API mode in Rails.
I have been motivated to build this application because I wanted to build an example project in Ruby on Rails API mode. This project is part of a Code Challenge where we have had the mission to import some data (dogs images
and names
) in our local database from an external Dogs API (https://dog.ceo/api/breeds/image/random) and create an endpoint to display the information. The import has been processed in a scheduled task that runs every day.
Built with Ruby on Rails.
- Ruby version: 3.1.2p20
- Rails version: 7.0.3
Database:
- Sqlite
Frontend:
- No FE, data exposed in JSON format.
- Example of successfull requests:
- Install Ruby on Rails
- Clone this repository.
- Database set up:
- Create the database
rails db:create
- Run migrations
rails db:migrate
- Run seeds
rails db:seed
rspec spec/
- Execute:
rails server
- Access to http://localhost:3000/api-docs/index.html to see swagger information API
- Example of request:
curl -X 'GET' \
'http://localhost:3000/api/v1/dogs' \
-H 'accept: */*'