A Ruby module for abstracting Web requests for testing, modular middleware and more.  For now this page is to bookmark some resources and start to understand how best to use Rack in Wagn, in particular for the development of the API.

 

Rails Guide on Rack

 

Following the links to this Introduction to Rack here is Hello World as a Rack app:

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

 

 

Now it is all about what is in env, and the protocols for passing stuff along with this object, and maybe more importantly, exceptions.

 

This is what Wagn has for rack by default (without any special rack configuration):

 

% rake middleware

 

use Rack::Lock

use ActionController::Failsafe

use HoptoadNotifier::Rack

use ActionController::Session::CookieStore, #<Proc:0x0000000000992960@(eval):8>

use ActionController::ParamsParser

use Rack::MethodOverride

use Rack::Head

use ActionController::StringCoercion

use ActiveRecord::ConnectionAdapters::ConnectionManagement

use ActiveRecord::QueryCache

run ActionController::Dispatcher.new



I think all of these modules process the request before in gets to the routes in routes.rb. I'm pretty sure that is called in Dispatcher.new.call(env)

  --Gerry Gleason.....Thu Mar 03 08:07:41 -0800 2011