6. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
7. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
8. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
•
Put the book in my cart
9. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the list of all books
10. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the list of all books
•
Get a specific book
11. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the list of all books
•
Get a specific book
12. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the list of all books
•
Get a specific book
•
Put the book in my cart
13. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the contents of my cart
14. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the contents of my cart
•
Delete a book from my cart
15. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the contents of my cart
•
Delete a book from my cart
•
Post money to Amazon
16. Amazon.com!
Let’s buy a book about Ruby on Rails
•
Get a list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the list of all books
•
Get a specific book
•
Put the book in my cart
•
Get the contents of my cart
•
Delete a book from my cart
•
Post money to Amazon
17. Amazon.com!
Let’s buy a book about Ruby on Rails
Verb
Noun
GET
books
PUT
cart
DELETE
book
POST
money
18. Amazon books
Books! !
!
!
! /books!
! Best sellers
/books/best_sellers!
! Hardcover
/books/hardcover
Sale
/books/sale
Top rated
/books/top_rated
24. Amazon.routes do
resources :books do
collection :top_rated
Amazon.rb
end
end
Prefix Verb
books GET
URI Pattern
Controller#Action
/books
books#index
/books/top_rated
books#top_rated
/books
books#create
/books/new
books#new
/books/:id/edit
books#edit
book GET
/books/:id
books#show
PUT
/books/:id
books#update
top_rated_books GET
POST
new_book GET
edit_book GET
DELETE /books/:id
books#destroy
25. Amazon.routes do
resources :books do
collection :top_rated
Amazon.rb
end
end
Prefix Verb
books GET
URI Pattern
Controller#Action
/books
books#index
/books/top_rated
books#top_rated
/books
books#create
/books/new
books#new
/books/:id/edit
books#edit
book GET
/books/:id
books#show
PUT
/books/:id
books#update
top_rated_books GET
POST
new_book GET
edit_book GET
DELETE /books/:id
books#destroy