What’s The Relation Between Rack, Rack Application, Rack Middleware, Rackup & Rails Application?
A mouth full of terms indeed! How else could I have shorten the title? Anyways, since you’re reading this, I’m sure you are confused as I am when I first came into these terms myself. Hope this post helps you understand better what all these are and how they relate to one another.
What is Rack?
Traditionally, ruby web framework developers would write an adapter for each web server they wanted their web framework to support. This is obviously unsustainable, hence a standard solutions is needed. Rack to the Rescue! Rack defines a standard way of interaction between web servers and ruby web applications. Rack basically is both a simple specification (the standard) and ruby library for connecting web servers to ruby web applications.
The Specification: Defines two things: an environment (env), which is a hash that contains CGI-like headers describing the request and a response, which is an array of values including the [response code, response headers, and response body].
Ruby Library: List of all modules and classes are available at http://rack.rubyforge.org/doc/classes/Rack.html