/app-api

APP-API

Primary LanguageRubyMIT LicenseMIT

App-API

Build Status Code Climate Dependency Status

Deploy

App with versioned API, secured with OAuth2 and automatically documented.

This is a basic Rails 4 application with Doorkeeper, Grape & Swagger for getting to API building quickly.

You can view the live app and the Swagger-ui documentation for developers.

Set up

Create .env file in the main folder of the project

.env file

SECRET_KEY_BASE=
DEVISE_SECRET_KEY=

DEFAULT_HOST=localhost:3000
EMAIL_ADDRESS=
EMAIL_PORT=
EMAIL_DOMAIN=
EMAIL_USER_NAME=
EMAIL_PASS=
EMAIL_AUTHENTICATION=
EMAIL_STARTTLS=

APP_API_DATABASE_USER=
APP_API_DATABASE_PASSWORD=

First bundle install and rake db:setup

Run rake start to get the server running locally. It runs at http://localhost:3001

Otherwise

Run rails s to get the server running locally. It runs at http://localhost:3000

Notes

Grape is mounted in app/controllers/api, as described in the excellent Introduction to building APIs with Grape by Monterail, and part 2 of the series.

There are are other posts in the series which are worth reading, particularly OAuth Implicit Grant with Grape, Doorkeeper and AngularJS.

There is also a Railscast on doorkeeper.

Important things in the Gemfile:

Also important, but maybe not as necessary to know about:


If you want to change the name of the app, swap out:

Testing

Rspec and guard - run bundle exec guard to watch your spec files for changes and rerun tests for those files, otherwise if you prefer just run rspec