Rack aims to provide a minimal API for connecting web servers supporting Ruby (like WEBrick, Mongrel etc.) and Ruby web frameworks (like Rails, Sinatra etc.).
A Rack application is a Ruby object (not a class) that responds to call
. It takes exactly one argument, the environment and returns an Array of exactly three values: The status, the headers, and the body.
The fundamental idea behind Rack middleware is - come between the calling client and the server, process the HTTP request before sending it to the server, and processing the HTTP response before returning it to the client.
Read. Unlike Rack applications, Rack middleware has knowledge of other Rack applications.