This API tracks sleep periods (e.g. for a toddler).
See the API documentation on Apiary: https://sleeptrackerapi.docs.apiary.io/
- Make sure you have Ruby installed. See this page for instructions to check if you already have Ruby installed, or what to do if you don't.
- Clone this repo, and
cd
into it. - Run
gem install bundler
- Run
bundle install
- Run
bundle exec rails server --port=3001
(or whatever port your frontend expects)
From another terminal, you should then be able to make HTTP requests to http://localhost:3001/people
or whatever endpoint you like, with whatever client or frontend you wish.
If you have the server running, you can make HTTP requests to add people, e.g. (using httpie):
http post localhost:3001/people name="Harry Potter" birthdate="31 July 1980"
Alternatively, you can manually add people from the Rails console. In your terminal:
bundle exec rails console
Person.create(name: "John Smith", birthdate: "12 January 2019")
, repeat as necessaryexit
Unit tests and request specs are written in RSpec. To run them, run bundle exec rspec --format documentation
.