bundle install
thin -R config.ru start
Point browser to http://localhost:3000/2
bundle install
thin -R config.ru start
Point browser to http://localhost:3000/2
require 'rack/request' | |
require 'journey' | |
require 'debugger' | |
separators = %w(/ . ?) | |
set = Journey::Routes.new | |
router = Journey::Router.new(set, { | |
:parameters_key => "rack.request.query_hash" | |
}) | |
Router = lambda do |env| | |
router.call env | |
end | |
App = lambda do |env| | |
key = "rack.request.query_hash" | |
body = "#{key}: #{env[key]}" | |
[200, {}, body] | |
end | |
strexp = Journey::Router::Strexp.new( | |
"/foo/:id", # path | |
{ :id => /\d+/ }, # requirements | |
separators) | |
path = Journey::Path::Pattern.new(strexp) | |
set.add_route App, | |
path, | |
{:request_method=>/^GET$/}, | |
{:foo => true} | |
$:.unshift(".") | |
require 'app' | |
run Router |
gem "actionpack" | |
gem "thin" |