Rack (web server interface)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Rack, a Ruby Webserver Interface
Original author(s) Christian Neukirchen
Developer(s) James Tucker, Josh Peek, José Valim, Michael Fellinger, Aaron Patterson, Santiago Pastorino, Konstantin Haase
Stable release 1.5.1 / January 28, 2013 (2013-01-28)
Operating system Cross-platform
Type Middleware
License MIT License
Website rack.github.io

Rack provides a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Rack is used by almost all Ruby web frameworks and libraries, such as Ruby On Rails and Sinatra. It is available as a Ruby Gem.

Rack has already inspired a JavaScript framework[1] (jackjs) and a Perl one (Plack), a Common Lisp project called clack, and has resulted in the Ruby developer quasi-standard of "rack-compliant".[2]

Example application[edit]

A Rack-compatible "Hello World" application in Ruby syntax:

app = lambda do |env|
  body = "Hello, World!"
  [200, {"Content-Type" => "text/plain", "Content-Length" => body.length.to_s}, [body]]
run app

See also[edit]


  1. ^ jack - introduction. Jackjs.org. Retrieved on 2013-09-20.
  2. ^ Pancake: How To Stack and Loosely Couple Rack-Based Webapps Together. Rubyinside.com (2009-12-04). Retrieved on 2013-09-20.

External links[edit]

There is a Rack IRC channel #rack at Freenode.