Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Rack: Fast Modular Ruby Web Server Interface

By Hendy Irawan / May 27, 2007

Rack, recently announced at version 0.2 by Christian Neukirchen, is a minimal, modular and adaptable interface for developing Ruby web applications. 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.

A simple Rack application looks like this:

class HelloWorld
def call(env)
[200, {"Content-Type"=>"text/plain"}, ["Hello world!"]]
end
end

If you ever think Rails is a bit overkill for some of your projects, you might just really like Rack. It supports web frameworks such as Camping, Ramaze, Maveric, and Racktools::SimpleApplication. The new version now supports FastCGI in addition to WEBrick, Mongrel/Swiftcore, and plain CGI.

Rack is installable as a Ruby gem:

gem install rack

Check out Chris' blog posts for more detailed information about Rack.

About Hendy Irawan

Ruby programmer from Indonesia. View all posts by Hendy Irawan →

Comments

  1. johan says:

    rack has supported fcgi since 0.1

Other Posts to Enjoy

Twitter Mentions