Skip to content

keeperofthenecklace/chicago_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

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.

Adding additional middleware

$ bundle exec rake middleware

Seeding & Running the web application

bundle exec rake db:create:all

bundle exec rake db:migrate

bundle exec rake db:seed

Testing API with Cucumber, Rack-test & Sinatra

From your terminal type:

rackup (starts sinatra on port=9292)
rake cucumber:all

Testing API with Curl

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"
}

About

A simple rails api using active_model::serializer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published