Rack

TwitterFacebook
Get flash to fully experience Pearltrees
If you've worked with Web apps using Ruby, you might know of Rack , an interface that sits between Ruby applications and HTTP-speaking Web servers. All of the major Ruby frameworks and server setups use it now, including Rails. Middleware (in Rack) is code that manipulates data going back and forth between your Ruby apps and the HTTP server. You can use middleware to intercept requests, change data in mid-flow, etc. Ryan Bates has a great screencast tutorial if you're new to the concept and want to build your own.

21 Rack Middlewares To Turbocharge Your Ruby Webapps

http://www.rubyinside.com/21-rack-middlewares-2649.html

Server Proxy

About Due to cross-domain access restrictions you will not be able to consume external web services via AJAX . To bypass this restrictions, we need to have a server proxy that would load and serve the external API via the same domain. This Rack middleware, helps you to do exactly that! http://coderack.org/users/laktek/middlewares/11-server-proxy
http://andyjeffries.co.uk/articles/real-world-uses-of-rails-metal-and-middleware

Real World Uses of Rails Metal and Middleware : Andy Jeffries :

What is Metal/Middleware? There are times when Rails feels very heavy! Jason Seifer has joked for ages about how Rails can’t scale , and we all know that’s a fallacy, but there are times when you know a bit of code is simple and could be really lightweight but having it as part of a controller, having gone through the Rails routing process and all the filters would just slow it down. Well, at the end of 2008 Rail Metal was introduced and it came like a breath of fresh air. It simply works as a lightweight class dropped in to /app/metal/ that is given the opportunity to handle a request before the main Rails stack.

litany against fear ¤ by nick quaranto ¤ Load Rails conditionall

http://quaran.to/blog/2009/11/10/load-rails-conditionally-with-rack/ published 10 Nov 2009 One of the great things about Gemcutter is that it’s using Sinatra via Rails Metal to serve up the gems. Recently, I had to run some long migrations (~10 minutes) and I’m sure we’ll have some more in the future. Since the gem server is decoupled from the Rails app, some clever Rack loading now allows us to continue to serve gems even when we’re down for maintenance. The config.ru now looks like this: