Skip to content

Instantly share code, notes, and snippets.

@iamvery
Created April 7, 2014 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamvery/10021601 to your computer and use it in GitHub Desktop.
Save iamvery/10021601 to your computer and use it in GitHub Desktop.

Farticles API

This is an example of a versioned Rails API using HTTP "accept" headers rather than including the version in resource URIs.

Getting started

Requirements

  1. Ruby 1.9 or >
  2. Postgres (I like http://postgresapp.com)

Setup

  1. Clone the repo

    git clone https://github.com/iamvery/farticles.git
    cd farticles
    
  2. Install dependencies

    bundle install
    
  3. Setup database

    bin/rake db:setup
    

Do things

Start the local development server:

bin/rails s

Request version 1 articles:

bin/rake request:v1:articles
[]

Request version 2 articles:

bin/rake request:v2:articles
{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment