This is a simple lightweight Rails::API project serving JSON resources to a seperate node app “chicago_north”. Chicago_north app is available in my private repository (WIP), is a single page application built on Flux, React.js (view) and Angular.js (model & controller).
The objective here is to slice what would be a monolithic Rails app into a lightweight backend serving API.
Devise is used to authenticate the user in each request.
$ bundle exec rake middleware
bundle exec rake db:create:all bundle exec rake db:migrate bundle exec rake db:seed
From your terminal type:
rackup (starts sinatra on port=9292) rake cucumber:all
From your terminal type:
$ rails s -p 3002 (starts WEBrick server on port=3002) curl localhost:3002/v1/login --data "user[email]=test@test.com&user[username]=user&user[password]=password&user[password_confirmation]=password"
You should have a JSON response similar to this:
{ "email":"test@test.com", "token_type":"Love_Is_An_Adventure!", "user_id":1, "access_token":"1:JzuQ1sXoAPfM_zWpuhNB" }