Rack (web server interface)

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

Lua error in package.lua at line 80: module 'strict' not found.

Lua error in Module:Infobox at line 314: malformed pattern (missing ']'). Rack provides a modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses it unifies the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Rack is used by many 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 one[2] (Clack), and has resulted in the Ruby developer quasi-standard of "rack-compliant".[3]

It was also cited as an inspiration for OWIN.[4]

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

See also

References

<templatestyles src="Reflist/styles.css" />

Cite error: Invalid <references> tag; parameter "group" is allowed only.

Use <references />, or <references group="..." />

External links


  1. jack - introduction. Jackjs.org. Retrieved on 2013-09-20.
  2. clacklisp.org. Retrieved on 2014-10-17.
  3. Pancake: How To Stack and Loosely Couple Rack-Based Webapps Together. Rubyinside.com (2009-12-04). Retrieved on 2013-09-20.
  4. http://www.asp.net/aspnet/overview/owin-and-katana/an-overview-of-project-katana. Asp.net. Retrieved on 2014-10-01.