-
Notifications
You must be signed in to change notification settings - Fork 21
Setup
-
Add the following to your Gemfile:
gem "stitches"
-
Install
> bundle install
-
Setup RSpec if you haven't already
> bin/rails generate rspec:install
-
Setup Apitome (which serves up your API documentation)
> bin/rails generate apitome:install
-
Run the stitches generator
> bin/rails generate stitches:api
-
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
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
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.