Rack (web server interface)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Rack, a Ruby Webserver Interface
Rack-logo.png
Original author(s) Christian Neukirchen
Developer(s) James Tucker, Michael Fellinger, Konstantin Haase, Aaron Patterson
Stable release 1.4.0 / December 28, 2011; 61 days ago (2011-12-28)
Operating system Cross-platform
Type Middleware
License MIT License
Website rack.rubyforge.org

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), and resulted in the Ruby developer quasi-standard of "rack-compliant".[2]

Contents

[edit] Example Application

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]]
end
 
run app

[edit] See also

[edit] References

[edit] External links

There is a Rack IRC channel #rack at Freenode.

Personal tools
Namespaces
Variants
Actions
Navigation
Interaction
Toolbox
Print/export
Languages