Rack (web server interface)

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.5.1 / January 28, 2013 (2013-01-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), a Common Lisp project called clack, and has resulted in the Ruby developer quasi-standard of "rack-compliant".[2]

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
↑Jump back a section

Read in another language

This page is available in 1 language

Last modified on 3 April 2013, at 01:07