Rack (web server interface)

from Wikipedia, the free encyclopedia
Rack: a Ruby web server interface

logo
Basic data

developer Leah Neukirchen; James Tucker, Michael Fellinger, Konstantin Haase, Aaron Patterson
Current  version 1.5.2
(2013-02-07)
operating system platform independent
programming language Ruby
category Middleware
License MIT License
rack.github.io

Rack provides a minimal, modular and adaptive interface for developing web applications in the Ruby programming language . By wrapping of HTTP requests and HTTP responses, which takes place in the simplest possible way, it standardizes the interface for web servers , web frameworks and software in between, so-called middleware , and distilled these accesses to a single method call.

Rack is used in almost all web frameworks and web libraries in the Ruby world, for example Ruby On Rails and Sinatra . It is available as a Ruby Gem .

Rack has a framework in the JavaScript world (jackjs) and one in the Perl -World ( Plack inspired) and represents a de facto standard of rack compatibility (in the Ruby world English "rack-compliant" ) is .

Sample application

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

require 'rack'

app = Proc.new do |env|
  body = "Hello, World!"
  ['200', {'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s}, [body]]
end

Rack::Handler::WEBrick.run app

See also

Web links

Individual evidence

  1. https://rubygems.org/gems/rack/
  2. jackjs.org ( Memento of the original from December 17, 2014 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / jackjs.org
  3. rubyinside.com