Fetch page contents from it's URL!
- Ruby: 2.4.0-p0
- Rails: 4.2.7
You can access this application on it's heroku site: Tiny Api!
To save a page create a post request to http://tiny-app.herokuapp.com/api/v1/pages
passing an url
as parameter.
To fetch created pages and their content, create a get request to http://tiny-api.herokuapp.com/api/v1/pages
Tiny API uses:
- Postgres Database
- Redis (3.3.0) (install with homebrew using
brew install redis
)
Prepare the project:
- Clone the repository.
bundle install
on app directory.bundle exec rake db:create
on app directory.bundle exec rake db:migrate
on app directory.
To run test, prepare test database and execute with:
bundle exec rake db:create RAILS_ENV=test
on app directory.bundle exec rake db:test:prepare
on app directory.bundle exec rake test
on app directory.
Open a command line terminal for each of the following items and execute the instruction:
- Start Redis server with
redis-server
(will start on tolocalhost:6379
by default). - Start Resque background queue that will handle page parsing with
QUEUE=* rake environment resque:work
. - Start Rails server with on app directory
rails s
(will start onlocalhost:3000
by default).
To save a page create a post request to localhost:3000/api/v1/pages
passing an url
as parameter.
To fetch created pages and their content, create a get request to localhost:3000/api/v1/pages