Rack (web server interface)
Encyclopedia
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
Middleware
Middleware is computer software that connects software components or people and their applications. The software consists of a set of services that allows multiple processes running on one or more machines to interact...

) into a single method call.

Rack is available as a Ruby Gem
RubyGems
RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries , a tool designed to easily manage the installation of gems, and a server for distributing them. It is analogous to EasyInstall for the Python programming...

.

Rack has already inspired a JavaScript framework (jackjs) and a Perl one (Plack
Plack (software)
Plack is a set of tools for running Perl-based Web applications and frameworks compatible with the PSGI specification.Plack was inspired by Rack for Ruby and Paste for Python.Plackup is a command-line tool for running the PSGI applications,...

), and resulted in the Ruby developer quasi-standard of "rack-compliant".

Example Application

A Rack-compatible "Hello World" application in Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...

 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

  • Python WSGI
    WSGI
    The Web Server Gateway Interface defines a simple and universal interface between web servers and web applications or frameworks for the Python programming language.-Idea:...

  • Perl Web Server Gateway Interface
    PSGI
    PSGI or Perl Web Server Gateway Interface is an interface between Web servers and Perl-based Web applications and frameworks that allows writing portable applications that can be run as standalone servers or using CGI, FastCGI, mod_perl, et al...

  • Python Paste
    Python Paste
    Python Paste, often simply called paste, is a set of utilities for web development in Python. Paste has been described as "a framework for web frameworks".-Python Paste:...

  • Smalltalk Seaside
  • FastCGI
    FastCGI
    FastCGI is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface ; FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page...

  • Java Servlet
    Java Servlet
    A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed via a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by Web servers...

  • Server-side JavaScript
    Server-side JavaScript
    Server-side JavaScript refers to JavaScript that runs on the server-side. This term was coined because the language is predominantly used on the client-side, i.e. client-side JavaScript ....

  • Apache JServ Protocol
    Apache JServ Protocol
    The Apache JServ Protocol is a binary protocol that can proxy inbound requests from a web server through to an application server that sits behind the web server. It also supports some monitoring in that the web server can ping the application server...

  • zeroc ICE
    Internet Communications Engine
    The Internet Communications Engine, or Ice, is an object-oriented middleware that provides object-oriented Remote Procedure Call, grid computing and Publish/subscribe functionality developed by ZeroC and dual-licensed under the GNU GPL and a proprietary license...

  • Cisco Etch
    Etch (protocol)
    Etch is an open source, cross-platform framework for building network services, first announced in May 2008 by Cisco Systems. Etch encompasses a service description language, a compiler, and a number of language bindings...

  • ISAPI
    ISAPI
    The Internet Server Application Programming Interface is an N-tier API of Internet Information Services , Microsoft's collection of Windows-based web server services...

    Internet Server Application Programming Interface (Microsoft)

External links


There is a Rack IRC channel #rack at Freenode.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK