Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Your Rails App is talking to you. Are you listening? by Nadja Lederer

Your Rails App is talking to you. Are you listening? by Nadja Lederer

presentation during Rails Girls St. Pölten: Your Rails App is talking to you. Are you listening? by the Coach Nadja Lederer

Your Rails App is talking to you. Are you listening? (http standard response codes and sample error pages)

Transcript

  1. [1]

    View Slide

  2. Your Rails App is talking to you…
    Are you listening?
    Nadja Lederer
    Rails Girls St. Pölten, 29.3.2014

    View Slide

  3. HTTP = Hypertext Transfer Protocol
    ¤  protocol used by the World Wide Web
    ¤  defines what a message looks like, and how a web server
    or browser responds to it
    [2]

    View Slide

  4. HTTP = Hypertext Transfer Protocol
    ¤  protocol used by the World Wide Web
    HTTP world Real-life situations
    GET get more information about sth
    POST create something, take a pic, write a
    book, code your rails app ;)
    PUT / PATCH get yourself a new styling, pimp your car
    DELETE burger / veggie place, order sth and eat it
    all up

    View Slide

  5. How does it work?
    [3]

    View Slide

  6. How does it work?

    View Slide

  7. How does it work?
    HTTP sends a question

    View Slide

  8. How does it work?
    HTTP sends a question
    HTTP sends an answer

    View Slide

  9. What do I see in the browser?

    View Slide

  10. Status codes
    200 OK | 404 Not Found | 301 Moved Permanently

    View Slide

  11. HTTP Status Code Classes
    ¤  1xx . . . Informational
    ¤  2xx . . . Success
    ¤  3xx . . . Redirection
    ¤  4xx . . . Client Error
    ¤  5xx . . . Server Error
    [4]

    View Slide

  12. [5]

    View Slide

  13. [6]

    View Slide

  14. Where’s my 404 – you ask?
    Let’s have a look at your Rails App…

    View Slide

  15. Error pages reside in the
    ./public
    directory of your app
    Customized
    content ;)

    View Slide

  16. View Slide

  17. Custom 404’s
    They can be so much fun…

    View Slide

  18. [7]

    View Slide

  19. [8]

    View Slide

  20. [9]

    View Slide

  21. Take away

    View Slide

  22. Take away
    ¤  GET, POST, PUT / PATCH, DELETE
    ¤  HTTP question & answer always come in pairs
    ¤  HTTP answer carries a status code
    ¤  Status codes tell about success / failure (and reason)
    ¤  Every Rails App has error pages in ./public directory
    ¤  Have fun customizing them ;)

    View Slide

  23. [10]

    View Slide

  24. Picture References
    [1] http://fab404.com/wp-content/uploads/2009/03/frye-wiles404.jpg
    [2] http://www.officeassist.ca/images/j0309261.jpg
    [3] http://symfony.com/doc/current/_images/http-xkcd.png
    [4] http://media-cache-ak0.pinimg.com/236x/ff/e2/2b/ffe22b2e7c226d79a6876281ed25a340.jpg
    [5] http://www.flickr.com/photos/girliemac/6508022985/in/photostream/
    [6] http://httpstatusdogs.com/301-moved-permanently
    [7] http://cdn6.blackhillswebworks.com/wp-content/uploads/2010/02/404page.jpg
    [8] http://www.evohosting.co.uk/wp-content/uploads/2011/07/freeassociation.png
    [9] http://blog.ifabbo.com/wp-content/uploads/404error.png
    [10] http://webdesignledger.com/wp-content/uploads/2009/10/404/25.jpg

    View Slide