Stupid Middleware Tricks

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    3 Favorites

    Stupid Middleware Tricks - Presentation Transcript

    1. Stupid Rack Middleware Tricks josh@aiderss.com @joshbuddy http://github.com/joshbuddy
    2. What is Rack?
    3. What is Rack? Standard interface for HTTP servers and application.
    4. What is Rack? Standard interface for HTTP servers and application. CGI, FastCGI, Mongrel, Thin, WEBrick and many more!
    5. What is Rack? Standard interface for HTTP servers and application. CGI, FastCGI, Rails, Merb, Mongrel, Thin, Sinatra, Ramaze, WEBrick a proc and many more! your next great framework
    6. What is Rack Middleware?
    7. What is Rack Middleware? HTTP Server
    8. What is Rack Middleware? HTTP Server Application
    9. What is Rack Middleware? HTTP Server Application
    10. What is Rack Middleware? Transparent Intercepting Caching Content filtering
    11. What is Rack Middleware? Transparent Intercepting Caching Content filtering (insert your thingy here)
    12. My Challenge
    13. My Challenge I'm going to write a new Rack Middleware everyday of RailsConf.
    14. My Challenge I'm going to write a new Rack Middleware everyday of RailsConf. (with tests)
    15. #1 Rack::Rewrite http://github.com/joshbuddy/rack-rewrite
    16. #1 Rack::Rewrite http://github.com/joshbuddy/rack-rewrite Get a request, rewrite it!
    17. #1 Rack::Rewrite http://github.com/joshbuddy/rack-rewrite Get a request, rewrite it! I hates this
    18. #1 Rack::Rewrite http://github.com/joshbuddy/rack-rewrite use Rack::Rewrite do on :method => 'get' do # If the request has a has a param of kitten=cute or # kitten=happy, lets log it and pass it on! # on :params => {:kitten => /cute|happy/} do act { log('what a nice cat') } pass end fail end end
    19. #2 Rack::Regenerate http://github.com/joshbuddy/rack-regenerate
    20. #2 Rack::Regenerate http://github.com/joshbuddy/rack-regenerate No idea. But say you had a request. And it was something you wanted to get hit every five minutes.
    21. #2 Rack::Regenerate http://github.com/joshbuddy/rack-regenerate X-Cache-Regenerate: [interval in seconds] [number of times to call]
    22. #2 Rack::Regenerate http://github.com/joshbuddy/rack-regenerate X-Cache-Regenerate: [interval in seconds] [number of times to call] X-Cache-Regenerate: 2 5 Request
    23. #2 Rack::Regenerate http://github.com/joshbuddy/rack-regenerate X-Cache-Regenerate: [interval in seconds] [number of times to call] X-Cache-Regenerate: 2 5 Request Response
    24. #2 Rack::Regenerate http://github.com/joshbuddy/rack-regenerate X-Cache-Regenerate: [interval in seconds] [number of times to call] X-Cache-Regenerate: 2 5 Request Response Intercept
    25. #2 Rack::Regenerate http://github.com/joshbuddy/rack-regenerate X-Cache-Regenerate: [interval in seconds] [number of times to call] X-Cache-Regenerate: 2 5 Request Response Intercept 2 seconds
    26. #2 Rack::Regenerate http://github.com/joshbuddy/rack-regenerate X-Cache-Regenerate: [interval in seconds] [number of times to call] X-Cache-Regenerate: 2 5 Request Response Intercept 2 seconds 2 seconds
    27. #2 Rack::Regenerate http://github.com/joshbuddy/rack-regenerate X-Cache-Regenerate: [interval in seconds] [number of times to call] X-Cache-Regenerate: 2 5 Request Response Intercept 2 seconds 2 seconds 5.times!
    28. #3 Rack::Capabilities http://github.com/joshbuddy/rack-capabilities
    29. #3 Rack::Capabilities http://github.com/joshbuddy/rack-capabilities Middleware
    30. #3 Rack::Capabilities http://github.com/joshbuddy/rack-capabilities Middleware Middleware
    31. #3 Rack::Capabilities http://github.com/joshbuddy/rack-capabilities Middleware Middleware Middleware
    32. #3 Rack::Capabilities http://github.com/joshbuddy/rack-capabilities Middleware Middleware Middleware Middleware
    33. #3 Rack::Capabilities http://github.com/joshbuddy/rack-capabilities Middleware Who’s that Middleware middleware Middleware ? Middleware
    34. #3 Rack::Capabilities http://github.com/joshbuddy/rack-capabilities # who is before me? Rack::Capabilities.before(self) # who is after me? Rack::Capabilities.after(self) # where can I go find AGoodTime? Rack::Capabilities.find(AGoodTime) # ==> nil
    35. #4 Rack::CacheWhileRevalidate http://github.com/joshbuddy/rack-cache-while-revalidate
    36. #4 Rack::CacheWhileRevalidate http://github.com/joshbuddy/rack-cache-while-revalidate Request
    37. #4 Rack::CacheWhileRevalidate http://github.com/joshbuddy/rack-cache-while-revalidate Request Cache
    38. #4 Rack::CacheWhileRevalidate http://github.com/joshbuddy/rack-cache-while-revalidate STALE! Request Cache
    39. #4 Rack::CacheWhileRevalidate http://github.com/joshbuddy/rack-cache-while-revalidate Request Cache Application Revalidate Serve stale data
    40. The End?

    + joshbuddyjoshbuddy, 6 months ago

    custom

    706 views, 3 favs, 2 embeds more stats

    My challenge, new middleware everyday. Here is my more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 706
      • 695 on SlideShare
      • 11 from embeds
    • Comments 0
    • Favorites 3
    • Downloads 16
    Most viewed embeds
    • 10 views on http://www.joshbuddy.com
    • 1 views on http://209.85.129.132

    more

    All embeds
    • 10 views on http://www.joshbuddy.com
    • 1 views on http://209.85.129.132

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories