MatthewRDodds / request-handler-demo

An example of a pattern I wrote about: http://matthewdodds.com/rails/2016/04/02/a-pattern-for-request-handling/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request Handler Demo

Installation

$ git clone git@github.com:MatthewRDodds/request-handler-demo.git
$ cd request-handler-demo
$ bundle install

Setup

bin/rake db:create db:migrate db:seed

Demo Requests

Valid Request

curl -XPOST \
     -H "Accept: application/json" \
     -H "Content-type: application/json" \
     -d '{"check_out":{"user_id":"1","book_id":"1"}}' \
     http://localhost:3000/api/check_outs

Invalid Request(s)

curl -XPOST \
     -H "Accept: application/json" \
     -H "Content-type: application/json" \
     -d '{"check_out":{"book_id":"1"}}' \
     http://localhost:3000/api/check_outs
curl -XPOST \
     -H "Accept: application/json" \
     -H "Content-type: application/json" \
     -d '{"check_out":{"user_id":"1"}}' \
     http://localhost:3000/api/check_outs

About

An example of a pattern I wrote about: http://matthewdodds.com/rails/2016/04/02/a-pattern-for-request-handling/


Languages

Language:Ruby 78.2%Language:HTML 17.1%Language:CSS 2.4%Language:JavaScript 2.3%