rails and resources - railsgirls leiden
TRANSCRIPT
![Page 1: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/1.jpg)
Rails and Resources
Bart Zonneveld
![Page 2: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/2.jpg)
Bart!Programmer
DeanDesigner
Sjoerd!Programmer
Niels!Project Lead
http://madebyhiro.com
![Page 3: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/3.jpg)
± 600.000 visitors / day !
± 700.000 videos / day
± 4.000 req / min (10k peak) !
230 ms avg response
Uitzending Gemist
![Page 4: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/4.jpg)
Amazon.com!Let’s buy a book about Ruby on Rails
![Page 5: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/5.jpg)
Amazon.com!Let’s buy a book about Ruby on Rails
• Get a list of all books
![Page 6: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/6.jpg)
Amazon.com!Let’s buy a book about Ruby on Rails
• Get a list of all books • Get a specific book
![Page 7: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/7.jpg)
Amazon.com!Let’s buy a book about Ruby on Rails
• Get a list of all books • Get a specific book
![Page 8: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/8.jpg)
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
![Page 9: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/9.jpg)
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
![Page 10: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/10.jpg)
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
![Page 11: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/11.jpg)
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
![Page 12: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/12.jpg)
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
![Page 13: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/13.jpg)
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
![Page 14: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/14.jpg)
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
![Page 15: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/15.jpg)
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
![Page 16: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/16.jpg)
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
![Page 17: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/17.jpg)
Amazon.com!Let’s buy a book about Ruby on Rails
Verb Noun
GET books
PUT cart
DELETE book
POST money
![Page 18: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/18.jpg)
Amazon books
Books! ! ! ! ! /books!
! Best sellers /books/best_sellers!
! Hardcover /books/hardcover
Sale /books/sale
Top rated /books/top_rated
![Page 19: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/19.jpg)
Top rated books!/books/top_rated
![Page 20: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/20.jpg)
Top rated books!/books/top_rated.json
!{ 'books' : [ ... { id: '3487', title: 'Agile Web Development with Rails 4', authors: [ 'Sam Ruby', 'Dave Thomas', 'David Heinemeier Hansson' ], price: '$ 26.37', rating: '4.2' } ... ]}
![Page 21: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/21.jpg)
Top rated books!/books/3487.json
!{ id: '3487', title: 'Agile Web Development with Rails 4', authors: [ 'Sam Ruby', 'Dave Thomas', 'David Heinemeier Hansson' ], price: '$ 26.37', rating: '4.2'}
![Page 22: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/22.jpg)
Amazon.rb
!
Amazon.routes do resources :books end
![Page 23: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/23.jpg)
Amazon.rb!
Amazon.routes do resources :books do collection :top_rated end end
![Page 24: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/24.jpg)
Amazon.rb
Prefix Verb URI Pattern Controller#Action
books GET /books books#index
top_rated_books GET /books/top_rated books#top_rated
POST /books books#create
new_book GET /books/new books#new
edit_book GET /books/:id/edit books#edit
book GET /books/:id books#show
PUT /books/:id books#update
DELETE /books/:id books#destroy
Amazon.routes do resources :books do collection :top_rated end end
![Page 25: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/25.jpg)
Amazon.rb
Prefix Verb URI Pattern Controller#Action
books GET /books books#index
top_rated_books GET /books/top_rated books#top_rated
POST /books books#create
new_book GET /books/new books#new
edit_book GET /books/:id/edit books#edit
book GET /books/:id books#show
PUT /books/:id books#update
DELETE /books/:id books#destroy
Amazon.routes do resources :books do collection :top_rated end end
![Page 26: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/26.jpg)
REpresentational State Transfer
Roy Fielding
Architectural Styles and the Design of Network-based Software Architectures (2000)
![Page 27: Rails and Resources - RailsGirls Leiden](https://reader033.vdocuments.mx/reader033/viewer/2022060111/5563c051d8b42ad83c8b526f/html5/thumbnails/27.jpg)
REpresentational State Transfer
“How I Explained REST to My Wife” Ryan Tomayko
tiny.cc/rest_rails