Skip to content
E.T.Cook edited this page Sep 2, 2019 · 4 revisions
  1. Add the following to your Gemfile:

    gem "stitches"
  2. Install

    > bundle install
    
  3. Setup RSpec if you haven't already

    > bin/rails generate rspec:install
    
  4. Setup Apitome (which serves up your API documentation)

    > bin/rails generate apitome:install
    
  5. Run the stitches generator

    > bin/rails generate stitches:api
    
  6. Finally, run DB migrations, since Stitches created a table you'll need

    > bundle exec rake db:migrate
    

You are now ready to write your first API. You might also want to know what all that just did

Upgrading from an older version of Stitches

If you have used stitches before, the enabled field was added to ApiClients, and you need to add that field to your database. You can do this by running the included generator:

rails g stitches:add_enabled_to_api_clients

And then:

rake db:migrate

Test the install

In your app run:

rake generate_api_key[some_name_you_pick]

Then follow the instructions it outputs.

If you are doing this locally and get an error like the following:

WEBrick::HTTPStatus::LengthRequired

that's because WEBrick doesn't want an empty body. Throw on a -d '' to the end of the command.

Clone this wiki locally